diff --git a/LiteWearable/entry/src/main/js/MainAbility/detail/detail.js b/LiteWearable/entry/src/main/js/MainAbility/detail/detail.js index 4140687765c97c5c3ec48372696007342e5abd9b..61bbba7be28ab8b83027e518e2689a51f3f9cdc4 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/detail/detail.js +++ b/LiteWearable/entry/src/main/js/MainAbility/detail/detail.js @@ -4,7 +4,7 @@ import router from '@ohos.router'; export default { clickAction() { - router.replaceUrl({ + this.getUIContext().getRouter().replaceUrl({ uri: 'pages/details/details' }); } diff --git a/LiteWearable/entry/src/main/js/MainAbility/details/details.js b/LiteWearable/entry/src/main/js/MainAbility/details/details.js index 8cce889e7d51d4eca3d54cceaf9e2400454b9e97..d14950210def13ba196e32c00267f34c4d662ac2 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/details/details.js +++ b/LiteWearable/entry/src/main/js/MainAbility/details/details.js @@ -4,7 +4,7 @@ import router from '@ohos.router'; export default { clickAction() { - router.replaceUrl({ + this.getUIContext().getRouter().replaceUrl({ uri: 'pages/index/index' }); } diff --git a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js index 8d9cfc726c9f630933ec07178db4b93965aff8de..fa5e7f15c96413a443b20e8607fcc34de77801e2 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js +++ b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.js @@ -9,7 +9,7 @@ export default { title: 'World' }, clickAction() { - router.replaceUrl({ + this.getUIContext().getRouter().replaceUrl({ uri: 'pages/details/details' }); }, diff --git a/MultiCommunityApplication/AppScope/app.json5 b/MultiCommunityApplication/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..28eac465352255ccb262622c5a1dd8b8d4ca8caa --- /dev/null +++ b/MultiCommunityApplication/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.multicommunityapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/MultiCommunityApplication/AppScope/resources/base/element/string.json b/MultiCommunityApplication/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..562f5959438dcf1621646da16aee19d0d92fc512 --- /dev/null +++ b/MultiCommunityApplication/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiCommunityApplication" + } + ] +} diff --git a/MultiCommunityApplication/AppScope/resources/base/media/background.png b/MultiCommunityApplication/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/MultiCommunityApplication/AppScope/resources/base/media/background.png differ diff --git a/MultiCommunityApplication/AppScope/resources/base/media/foreground.png b/MultiCommunityApplication/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb Binary files /dev/null and b/MultiCommunityApplication/AppScope/resources/base/media/foreground.png differ diff --git a/MultiCommunityApplication/AppScope/resources/base/media/layered_image.json b/MultiCommunityApplication/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/MultiCommunityApplication/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/LICENSE b/MultiCommunityApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1cc99b4e333c57fe6ce9f38c0cb988fb4c4f1c8f --- /dev/null +++ b/MultiCommunityApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 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/MultiCommunityApplication/README.en.md b/MultiCommunityApplication/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..ca1114b134acdb23bc66692ffb3e1d7ca82060f7 --- /dev/null +++ b/MultiCommunityApplication/README.en.md @@ -0,0 +1,46 @@ +# Community Comments + +### Introduction + +Based on the adaptive and responsive layout, implement community comment pages with one-time development for multi-device deployment. + +The figure shows the effect on the mobile phone: + +![](screenshots/device/phone.en.png) + +The figure shows the effect on the foldable phone: + +![](screenshots/device/foldable.en.png) + +The figure shows the effect on the tablet: + +![](screenshots/device/pad.en.png) + +### Concepts + +- One-time development for multi-device deployment: It enables you to develop and release one set of project code for deployment on multiple devices as demanded. This feature enables you to efficiently develop applications that are compatible with multiple devices while providing distributed user experiences for cross-device transferring, migration, and collaboration. +- Adaptive layout: When the size of an external container changes, elements can automatically change based on the relative relationship to adapt to the external container. Relative relationships include the proportion, fixed aspect ratio, and display priority. +- Responsive layout: When the size of an external container changes, elements can automatically change based on the breakpoints, grids, or specific features (such as the screen direction and window width and height) to adapt to the external container. +- GridRow: It is a container that is used in a grid layout, together with its child component ****. +- GridCol: It is a container that must be used as a child component of the **** container. + + +### How to Use + +1. Install and open an app on a mobile phone, foldable phone, or tablet. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +2. Tap home, hot topics, message, or mine tab at the bottom to switch to the corresponding tab page. By default, the message tab page is displayed. +3. Tap a category of hot searches to switch to the corresponding list. +4. Tap the button for viewing complete rankings. The hot search rankings page is displayed. You can swipe up, down, left, or right on the hot search rankings page and tap the back button to return to the hot topics page. +5. Tap an image on the hot topics page to go to the image details page. Only images are displayed on mobile phones, while the content and comments are displayed with images on foldable phones and tablets. Tap the image or the back button to return to the hot topics page. +6. Tap the widget body on the hot topics page to go to the details page. The text area on the details page can be zoomed in or out with two fingers. You can tap the button in the upper right corner of the foldable phone to switch between the left-right layout and top-down layout. Tap the back button to return to the hot topics page. + +### Permissions + +N/A. + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later +3. DevEco Studio: DevEco Studio 5.0.0 Release or later +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later diff --git a/MultiCommunityApplication/README.md b/MultiCommunityApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..54d7af6fc72c41f65f1b1386e74909657f8f68b7 --- /dev/null +++ b/MultiCommunityApplication/README.md @@ -0,0 +1,45 @@ +# 一次开发,多端部署-社区评论 + +### 简介 + +基于自适应布局和响应式布局,实现一次开发,多端部署的社区评论页。 + +手机运行效果图如下: + +![](screenshots/device/phone.png) + +折叠屏运行效果图如下: + +![](screenshots/device/foldable.png) + +平板运行效果图如下: + +![](screenshots/device/pad.png) + +### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 自适应布局:当外部容器大小发生变化时,元素可以根据相对关系自动变化以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。 +- 响应式布局:当外部容器大小发生变化时,元素可以根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化以适应外部容器变化的布局能力。 +- GridRow:栅格容器组件,仅可以和栅格子组件(GridCol)在栅格布局场景中使用。 +- GridCol:栅格子组件,必须作为栅格容器组件(GridRow)的子组件使用。 + +### 使用说明 + +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 点击底部首页、热点、消息、我的图片文字按钮,切换显示对应的标签页,默认显示热点标签页。 +3. 点击热搜标题,切换热搜列表。 +4. 点击查看完整榜单按钮,跳转至热搜榜单页。热搜榜单页支持上下及左右滑动,点击返回按钮退回至热点页。 +5. 热点页点击图片进入图片详情页。手机设备只展示图片,折叠屏及平板展示正文及评论。点击图片或返回按钮退回至热点页。 +6. 热点页点击卡片正文进入详情页。详情页正文文字区域支持双指缩放。折叠屏右上角按钮支持切换左右及上下布局。点击返回按钮退回至热点页。 + +### 相关权限 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 diff --git a/MultiCommunityApplication/build-profile.json5 b/MultiCommunityApplication/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0e9cedf82137489dd93d0163d43c20d024211388 --- /dev/null +++ b/MultiCommunityApplication/build-profile.json5 @@ -0,0 +1,101 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./products/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./commons/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "detail", + "srcPath": "./features/detail", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "hot", + "srcPath": "./features/hot", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "rank", + "srcPath": "./features/rank", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "picture", + "srcPath": "./features/picture", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/Index.ets b/MultiCommunityApplication/commons/base/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..eaf7c956792160c05f8351a55d2c8e955535a341 --- /dev/null +++ b/MultiCommunityApplication/commons/base/Index.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 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 { BreakpointConstants } from './src/main/ets/constants/BreakpointConstants'; + +export { BreakpointType } from './src/main/ets/constants/BreakpointType'; + +export { CommentItemInterface, CommentItem } from './src/main/ets/viewmodel/CommentViewModel'; + +export { COMMENT_LIST } from './src/main/ets/model/CommentModel'; + +export { CommonConstants } from './src/main/ets/constants/CommonConstants'; + +export { HOST_LIST_ARRAY } from './src/main/ets/model/HotModel'; + +export { HotItemInterface } from './src/main/ets/model/HotModel'; + +export { default as Logger } from './src/main/ets/utils/Logger'; + +export { CardItemInterface, CARD_LIST } from './src/main/ets/model/CardListModel'; + +export { PICTURE_ARRAY_LIST } from './src/main/ets/model/PictureArrayModel'; \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/build-profile.json5 b/MultiCommunityApplication/commons/base/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..da1e864745177ec7d3786ade0b6950aba4ebcc4f --- /dev/null +++ b/MultiCommunityApplication/commons/base/build-profile.json5 @@ -0,0 +1,27 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/hvigorfile.ts b/MultiCommunityApplication/commons/base/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiCommunityApplication/commons/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/commons/base/obfuscation-rules.txt b/MultiCommunityApplication/commons/base/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/commons/base/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/oh-package.json5 b/MultiCommunityApplication/commons/base/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c764a93a96ab677a53c95087b3858bd0524e4e76 --- /dev/null +++ b/MultiCommunityApplication/commons/base/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets b/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa093f5584b7d327985e1f195bc7fb0580e6d309 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [12, 15, 4, 5]; + + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [12, 6, 7, 5, 3, 4, 2]; + + /** + * Breakpoint ranges. + */ + static readonly BREAKPOINT_RANGES: number[] = [320, 600, 840]; +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointType.ets b/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointType.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8f3224bae5f6de507888c1bd10b4dd6681e6995 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/constants/BreakpointType.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from './BreakpointConstants'; + +export class BreakpointType { + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + getValue(currentBreakpoint: string): T { + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/constants/CommonConstants.ets b/MultiCommunityApplication/commons/base/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..2165033ef721a4fff337273e9ada5022c42961f8 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Common constants for all features. + */ +export class CommonConstants { + /** + * Full percent. + */ + static readonly FULL_PERCENT: string = '100%'; + + /** + * Half percent. + */ + static readonly HALF_PERCENT: string = '50%'; + + /** + * Font weight 500. + */ + static readonly FONT_WEIGHT_500: number = 500; + + /** + * Font weight 700. + */ + static readonly FONT_WEIGHT_700: number = 700; + + /** + * Rank title List. + */ + static readonly RANK_TITLE_LIST: ResourceStr[] = + [$r('app.string.today_hot_search'), $r('app.string.news_hot_search'), $r('app.string.same_city_hot_search'), + $r('app.string.entertainment_hot_search'), $r('app.string.food_hot_search')]; + + /** + * Device PC/2in1. + */ + static readonly DEVICE_2IN1: string = '2in1'; +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/model/CardListModel.ets b/MultiCommunityApplication/commons/base/src/main/ets/model/CardListModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5a0114cfce8d6fb99beede76fe5c7ff00eb981d --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/model/CardListModel.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 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 interface CardItemInterface { + icon: ResourceStr; + name: ResourceStr; + authorType: ResourceStr; + content: ResourceStr; +} + +export const CARD_LIST: CardItemInterface[] = [ + { + icon: $r('app.media.ic_icon_1'), + name: $r('app.string.name_1'), + authorType: $r('app.string.author_type_1'), + content: $r('app.string.content_1') + }, + { + icon: $r('app.media.ic_icon_2'), + name: $r('app.string.name_2'), + authorType: $r('app.string.author_type_1'), + content: $r('app.string.content_2') + }, + { + icon: $r('app.media.ic_icon_2'), + name: $r('app.string.name_2'), + authorType: $r('app.string.author_type_1'), + content: $r('app.string.content_3') + }, + { + icon: $r('app.media.ic_icon_3'), + name: $r('app.string.name_3'), + authorType: $r('app.string.author_type_2'), + content: $r('app.string.content_4') + }, + { + icon: $r('app.media.ic_icon_4'), + name: $r('app.string.name_4'), + authorType: $r('app.string.author_type_3'), + content: $r('app.string.content_5') + }, + { + icon: $r('app.media.ic_icon_2'), + name: $r('app.string.name_5'), + authorType: $r('app.string.author_type_4'), + content: $r('app.string.content_6') + }, + { + icon: $r('app.media.ic_icon_1'), + name: $r('app.string.name_1'), + authorType: $r('app.string.author_type_1'), + content: $r('app.string.content_1') + }, + { + icon: $r('app.media.ic_icon_2'), + name: $r('app.string.name_2'), + authorType: $r('app.string.author_type_1'), + content: $r('app.string.content_2') + }, + { + icon: $r('app.media.ic_icon_3'), + name: $r('app.string.name_3'), + authorType: $r('app.string.author_type_2'), + content: $r('app.string.content_4') + }, + { + icon: $r('app.media.ic_icon_4'), + name: $r('app.string.name_4'), + authorType: $r('app.string.author_type_3'), + content: $r('app.string.content_5') + }, + { + icon: $r('app.media.ic_icon_2'), + name: $r('app.string.name_5'), + authorType: $r('app.string.author_type_4'), + content: $r('app.string.content_6') + } +] \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/model/CommentModel.ets b/MultiCommunityApplication/commons/base/src/main/ets/model/CommentModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b654e2c03ff995f28b38062cd5f5b9bdf131d49 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/model/CommentModel.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommentItemInterface } from '../viewmodel/CommentViewModel'; + +export const COMMENT_LIST: CommentItemInterface[] = [ + { + icon: $r('app.media.ic_comment_1'), + name: $r('app.string.name_6'), + favorCount: 41, + content: $r('app.string.content_7'), + timePosition: $r('app.string.time_position_1'), + reviewCnt: 123, + subContent: $r('app.string.sub_content_1') + }, + { + icon: $r('app.media.ic_comment_2'), + name: $r('app.string.name_7'), + favorCount: 36, + content: $r('app.string.content_8'), + timePosition: $r('app.string.time_position_2'), + reviewCnt: 12, + subContent: $r('app.string.sub_content_1') + }, + { + icon : $r('app.media.ic_comment_3'), + name: $r('app.string.name_8'), + favorCount: 432, + content: $r('app.string.content_9'), + timePosition: $r('app.string.time_position_3') + }, + { + icon : $r('app.media.ic_icon_2'), + name : $r('app.string.name_5'), + favorCount: 33, + content : $r('app.string.content_10'), + timePosition: $r('app.string.time_position_3') + }, + { + icon : $r('app.media.ic_comment_1'), + name : $r('app.string.name_9'), + favorCount: 6, + content : $r('app.string.content_11'), + timePosition: $r('app.string.time_position_4') + }, + { + icon : $r('app.media.ic_comment_2'), + name : $r('app.string.name_10'), + favorCount: 5, + content : $r('app.string.content_12'), + timePosition: $r('app.string.time_position_5') + }, + { + icon : $r('app.media.ic_comment_3'), + name : $r('app.string.name_11'), + favorCount: 33, + content : $r('app.string.content_13'), + timePosition: $r('app.string.time_position_6') + } +] \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/model/HotModel.ets b/MultiCommunityApplication/commons/base/src/main/ets/model/HotModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2981d0e36b3a51b3cff1f5186322bbe0b5eca19 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/model/HotModel.ets @@ -0,0 +1,712 @@ +/* + * Copyright (c) 2023 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 interface HotItemInterface { + index: number; + icon: Resource; + title: ResourceStr; + content: ResourceStr; + stateIcon: ResourceStr; + clickCount: number; + upDownIcon: ResourceStr; +} + +export const HOST_LIST_ARRAY: Array = [ + [ + { + index: 1, + icon: $r('app.media.ic_today_rank_1'), + title: $r('app.string.title_1'), + content: $r('app.string.content_14'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 666, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 2, + icon: $r('app.media.ic_today_rank_2'), + title: $r('app.string.title_2'), + content: $r('app.string.content_15'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 651, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 3, + icon: $r('app.media.ic_today_rank_3'), + title: $r('app.string.title_3'), + content: $r('app.string.content_16'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 576, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 4, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 556, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 5, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 532, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 6, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 501, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 7, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 489, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 8, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 473, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 9, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 421, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 10, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 389, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 11, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 365, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 12, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 349, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 13, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 311, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 14, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 278, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 15, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 257, + upDownIcon: $r('app.media.ic_up') + } + ], + [ + { + index: 1, + icon: $r('app.media.ic_news_rank_1'), + title: $r('app.string.title_9'), + content: $r('app.string.content_22'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 666, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 2, + icon: $r('app.media.ic_news_rank_2'), + title: $r('app.string.title_10'), + content: $r('app.string.content_23'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 651, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 3, + icon: $r('app.media.ic_news_rank_3'), + title: $r('app.string.title_11'), + content: $r('app.string.content_24'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 576, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 4, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 556, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 5, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 532, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 6, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 501, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 7, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 489, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 8, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 473, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 9, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 421, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 10, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 389, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 11, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 365, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 12, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 349, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 13, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 311, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 14, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 278, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 15, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 257, + upDownIcon: $r('app.media.ic_up') + } + ], + [ + { + index: 1, + icon: $r('app.media.ic_city_rank_1'), + title: $r('app.string.title_12'), + content: $r('app.string.content_25'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 666, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 2, + icon: $r('app.media.ic_city_rank_2'), + title: $r('app.string.title_13'), + content: $r('app.string.content_26'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 651, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 3, + icon: $r('app.media.ic_city_rank_3'), + title: $r('app.string.title_14'), + content: $r('app.string.content_27'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 576, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 4, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 556, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 5, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 532, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 6, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 501, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 7, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 489, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 8, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 473, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 9, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 421, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 10, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 389, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 11, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 365, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 12, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 349, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 13, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 311, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 14, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 278, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 15, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 257, + upDownIcon: $r('app.media.ic_up') + } + ], + [ + { + index: 1, + icon: $r('app.media.ic_fun_rank_1'), + title: $r('app.string.title_15'), + content: $r('app.string.content_28'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 666, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 2, + icon: $r('app.media.ic_fun_rank_2'), + title: $r('app.string.title_16'), + content: $r('app.string.content_29'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 651, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 3, + icon: $r('app.media.ic_fun_rank_3'), + title: $r('app.string.title_17'), + content: $r('app.string.content_30'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 576, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 4, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 556, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 5, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 532, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 6, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 501, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 7, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 489, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 8, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 473, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 9, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 421, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 10, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 389, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 11, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 365, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 12, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 349, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 13, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 311, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 14, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 278, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 15, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 257, + upDownIcon: $r('app.media.ic_up') + } + ], + [ + { + index: 1, + icon: $r('app.media.ic_food_rank_1'), + title: $r('app.string.title_18'), + content: $r('app.string.content_31'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 666, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 2, + icon: $r('app.media.ic_food_rank_2'), + title: $r('app.string.title_19'), + content: $r('app.string.content_32'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 651, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 3, + icon: $r('app.media.ic_food_rank_3'), + title: $r('app.string.title_20'), + content: $r('app.string.content_33'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 576, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 4, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 556, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 5, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 532, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 6, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 501, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 7, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 489, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 8, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 473, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 9, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 421, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 10, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 389, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 11, + icon: $r('app.media.ic_rank_item_1'), + title: $r('app.string.title_6'), + content: $r('app.string.content_19'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 365, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 12, + icon: $r('app.media.ic_rank_item_2'), + title: $r('app.string.title_7'), + content: $r('app.string.content_20'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 349, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 13, + icon: $r('app.media.ic_rank_item_3'), + title: $r('app.string.title_8'), + content: $r('app.string.content_21'), + stateIcon: $r('app.media.ic_state_favor'), + clickCount: 311, + upDownIcon: $r('app.media.ic_up') + }, + { + index: 14, + icon: $r('app.media.ic_rank_item_4'), + title: $r('app.string.title_4'), + content: $r('app.string.content_17'), + stateIcon: $r('app.media.ic_state_new'), + clickCount: 278, + upDownIcon: $r('app.media.ic_down') + }, + { + index: 15, + icon: $r('app.media.ic_rank_item_5'), + title: $r('app.string.title_5'), + content: $r('app.string.content_18'), + stateIcon: $r('app.media.ic_state_fire'), + clickCount: 257, + upDownIcon: $r('app.media.ic_up') + } + ] +] \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/model/PictureArrayModel.ets b/MultiCommunityApplication/commons/base/src/main/ets/model/PictureArrayModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..66753a0f09ba7ae0a78a1be6b6cc3a879a96ed22 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/model/PictureArrayModel.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2023 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 const PICTURE_ARRAY_LIST: Array = [ + [ + $r('app.media.ic_social_circle1') + ], + [ + $r('app.media.ic_social_circle8') + ], + [ + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle4'), + $r('app.media.ic_social_circle5'), + $r('app.media.ic_social_circle6') + ], + [ + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle4') + ], + [ + $r('app.media.ic_social_circle9'), + $r('app.media.ic_social_circle8'), + $r('app.media.ic_social_circle6'), + $r('app.media.ic_social_circle5'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle1'), + $r('app.media.ic_social_circle2') + + ], + [ + $r('app.media.ic_social_circle1'), + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle7'), + $r('app.media.ic_social_circle5') + ], + [ + $r('app.media.ic_social_circle1'), + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle4'), + $r('app.media.ic_social_circle5'), + $r('app.media.ic_social_circle6'), + $r('app.media.ic_social_circle7'), + $r('app.media.ic_social_circle8'), + $r('app.media.ic_social_circle9') + ], + [ + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle4'), + $r('app.media.ic_social_circle5'), + $r('app.media.ic_social_circle6'), + $r('app.media.ic_social_circle7') + ], + [ + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle6'), + $r('app.media.ic_social_circle8') + ], + [ + $r('app.media.ic_social_circle1'), + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle4'), + $r('app.media.ic_social_circle5'), + $r('app.media.ic_social_circle6'), + $r('app.media.ic_social_circle7'), + $r('app.media.ic_social_circle8') + ], + [ + $r('app.media.ic_social_circle1'), + $r('app.media.ic_social_circle2'), + $r('app.media.ic_social_circle3'), + $r('app.media.ic_social_circle4'), + $r('app.media.ic_social_circle6') + ] +] \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/utils/Logger.ets b/MultiCommunityApplication/commons/base/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..a84d197622d6863af4fa291d5bf461cf50be1576 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/utils/Logger.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + /** + * Constructor. + * + * @param Prefix Identifies the log tag. + * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. + */ + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('CommunityApplication'); \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/ets/viewmodel/CommentViewModel.ets b/MultiCommunityApplication/commons/base/src/main/ets/viewmodel/CommentViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e5a5b096c4ee5459628bca9affb42ebac7759fe --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/ets/viewmodel/CommentViewModel.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 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 interface CommentItemInterface { + icon: ResourceStr; + name: ResourceStr; + favorCount: number; + content: ResourceStr; + timePosition: ResourceStr; + reviewCnt?: number; + subContent?: ResourceStr; +} + +export class CommentItem implements CommentItemInterface { + icon: ResourceStr; + name: ResourceStr; + favorCount: number; + content: ResourceStr; + timePosition: ResourceStr; + reviewCnt?: number; + subContent?: ResourceStr; + + constructor(item: CommentItemInterface) { + this.icon = item.icon; + this.name = item.name; + this.favorCount = item.favorCount; + this.content = item.content; + this.timePosition = item.timePosition; + if (item?.reviewCnt) { + this.reviewCnt = item.reviewCnt; + } + if (item?.subContent) { + this.subContent = item.subContent; + } + } +} diff --git a/MultiCommunityApplication/commons/base/src/main/module.json5 b/MultiCommunityApplication/commons/base/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9c4d9041e0ff8174abb8f746e862ef89b1459a97 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "base", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/element/color.json b/MultiCommunityApplication/commons/base/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/element/string.json b/MultiCommunityApplication/commons/base/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b247e4be56b2d2d35336e061cf75bb3a463a8dd --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/element/string.json @@ -0,0 +1,328 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "today_hot_search", + "value": "今日热搜" + }, + { + "name": "news_hot_search", + "value": "要闻热搜" + }, + { + "name": "same_city_hot_search", + "value": "同城热搜" + }, + { + "name": "entertainment_hot_search", + "value": "娱乐热搜" + }, + { + "name": "food_hot_search", + "value": "美食热搜" + }, + { + "name": "name_1", + "value": "小鱼儿" + }, + { + "name": "name_2", + "value": "熊猫大人" + }, + { + "name": "name_3", + "value": "飞行日记" + }, + { + "name": "name_4", + "value": "江湖旅客" + }, + { + "name": "name_5", + "value": "摄影D叔" + }, + { + "name": "name_6", + "value": "柯基可可" + }, + { + "name": "name_7", + "value": "会飞的鱼儿" + }, + { + "name": "name_8", + "value": "摄影学家王教授" + }, + { + "name": "name_9", + "value": "雪中小镇" + }, + { + "name": "name_10", + "value": "江湖游客" + }, + { + "name": "name_11", + "value": "吕家寨子" + }, + { + "name": "author_type_1", + "value": "环保领域作者" + }, + { + "name": "author_type_2", + "value": "科技领域作者" + }, + { + "name": "author_type_3", + "value": "旅行领域作者" + }, + { + "name": "author_type_4", + "value": "风景摄影领域作者" + }, + { + "name": "content_1", + "value": "亲近大海,领悟海,体会到了海的心声,海自然与你共鸣,无需可以强求,也无需费力搜寻,海,始终都会以潮声与你相亲,已其海色伴你舒适。亲近大海,领悟海,体会到了海的心声,海自然与你共鸣,无需可以强求,也无需费力搜寻,海,始终都会以潮声与你相亲,已其海色伴你舒适。" + }, + { + "name": "content_2", + "value": "野生动物与宠物动物,可爱的动物人人都喜欢。野生动物与宠物动物,可爱的动物人人都喜欢。野生动物与宠物动物,可爱的动物人人都喜欢。野生动物与宠物动物,可爱的动物人人都喜欢。野生动物与宠物动物,可爱的动物人人都喜欢。野生动物与宠物动物,可爱的动物人人都喜欢。" + }, + { + "name": "content_3", + "value": "君不见,黄河之水天上来,奔流到海不复回。君不见,高堂明镜悲白发,朝如青丝暮成雪。人生得意须尽欢,莫使金樽空对月。天生我材必有用,千金散尽还复来。烹羊宰牛且为乐,会须一饮三百杯。岑夫子,丹丘生,将进酒,杯莫停。与君歌一曲,请君为我倾耳听。钟鼓馔玉不足贵,但愿长醉不愿醒。古来圣贤皆寂寞,惟有饮者留其名。陈王昔时宴平乐,斗酒十千恣欢谑。主人何为言少钱,径须沽取对君酌。五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。" + }, + { + "name": "content_4", + "value": "群鸟,仿佛从大地的心窝飞起的音符。旋风似的从田野腾空而起。小鸟的头部两侧镶嵌着一双宝石般的小眼睛,嘴巴长长的,上面是它的小鼻子。群鸟,仿佛从大地的心窝飞起的音符。旋风似的从田野腾空而起。小鸟的头部两侧镶嵌着一双宝石般的小眼睛,嘴巴长长的,上面是它的小鼻子。" + }, + { + "name": "content_5", + "value": "伫立于河流两岸的山峦,如同沉默无言的僧侣,眺望着远方。伫立于河流两岸的山峦,如同沉默无言的僧侣,眺望着远方。伫立于河流两岸的山峦,如同沉默无言的僧侣,眺望着远方。伫立于河流两岸的山峦,如同沉默无言的僧侣,眺望着远方。" + }, + { + "name": "content_6", + "value": "九如山的山,山山相连,连绵起伏。山腰盘旋的那曲折险峻的实木栈道,如缕缕飘带缠绕在绿水青山之中,成为一道独特的亮丽风景;幽深的小谷之中,升腾着鬼神莫测的云雾。九如山的山,山山相连,连绵起伏。山腰盘旋的那曲折险峻的实木栈道,如缕缕飘带缠绕在绿水青山之中,成为一道独特的亮丽风景;幽深的小谷之中,升腾着鬼神莫测的云雾。" + }, + { + "name": "content_7", + "value": "拍的很好啊!赞" + }, + { + "name": "content_8", + "value": "滚滚长江东逝水,浪花淘尽英雄。" + }, + { + "name": "content_9", + "value": "这组图片饱含了国风风格" + }, + { + "name": "content_10", + "value": "会当凌绝顶!" + }, + { + "name": "content_11", + "value": "拍的真好!爱了爱了!" + }, + { + "name": "content_12", + "value": "千古江湖图一醉" + }, + { + "name": "content_13", + "value": "好看,期待更新" + }, + { + "name": "content_14", + "value": "规范野生动植物管理" + }, + { + "name": "content_15", + "value": "人类建筑史上的奇迹" + }, + { + "name": "content_16", + "value": "雾绕青山枝叶绿" + }, + { + "name": "content_17", + "value": "舞者们台下十年练习之路" + }, + { + "name": "content_18", + "value": "揭秘宇宙的奥秘" + }, + { + "name": "content_19", + "value": "欧洲建筑的历史责任在对欧洲..." + }, + { + "name": "content_20", + "value": "世界十大神奇建筑指的是建筑造型..." + }, + { + "name": "content_21", + "value": "小小世界的生存智慧是非常..." + }, + { + "name": "content_22", + "value": "艺术如同一首悠扬的乐曲" + }, + { + "name": "content_23", + "value": "浩瀚宇宙有边际吗" + }, + { + "name": "content_24", + "value": "人的精神世界的总和" + }, + { + "name": "content_25", + "value": "夏天的气息扑面而来" + }, + { + "name": "content_26", + "value": "这里的花开了" + }, + { + "name": "content_27", + "value": "旅行是种什么体验" + }, + { + "name": "content_28", + "value": "吉他有许多不同的音色" + }, + { + "name": "content_29", + "value": "轻轻地拂过我的耳畔" + }, + { + "name": "content_30", + "value": "静下来做事是难得的品质" + }, + { + "name": "content_31", + "value": "红彤彤的苹果像小灯笼" + }, + { + "name": "content_32", + "value": "带你去吃健康的蔬菜" + }, + { + "name": "content_33", + "value": "儿时香甜的味道" + }, + { + "name": "time_position_1", + "value": "10分钟前·来自上海" + }, + { + "name": "time_position_2", + "value": "10-23·来自上海" + }, + { + "name": "time_position_3", + "value": "10-22·来自上海" + }, + { + "name": "time_position_4", + "value": "10-21·来自上海" + }, + { + "name": "time_position_5", + "value": "10-19·来自上海" + }, + { + "name": "time_position_6", + "value": "10-13·来自上海" + }, + { + "name": "sub_content_1", + "value": "长江:对了//@森林:是佳能拍出的效果啊,太赞了" + }, + { + "name": "title_1", + "value": "野生动物保护" + }, + { + "name": "title_2", + "value": "世界有名建筑" + }, + { + "name": "title_3", + "value": "茶叶的神奇功效" + }, + { + "name": "title_4", + "value": "舞动者们" + }, + { + "name": "title_5", + "value": "宇宙最遥远的样子" + }, + { + "name": "title_6", + "value": "建筑人文" + }, + { + "name": "title_7", + "value": "世界十大神奇建筑" + }, + { + "name": "title_8", + "value": "生命之谜语" + }, + { + "name": "title_9", + "value": "艺术之美" + }, + { + "name": "title_10", + "value": "太空高清图片" + }, + { + "name": "title_11", + "value": "心灵的修行" + }, + { + "name": "title_12", + "value": "夏天来了" + }, + { + "name": "title_13", + "value": "新的打卡景点" + }, + { + "name": "title_14", + "value": "带宠物去旅行" + }, + { + "name": "title_15", + "value": "吉他之声" + }, + { + "name": "title_16", + "value": "聆听美妙的声音" + }, + { + "name": "title_17", + "value": "安静的工作" + }, + { + "name": "title_18", + "value": "超市的果子" + }, + { + "name": "title_19", + "value": "蔬菜种植" + }, + { + "name": "title_20", + "value": "儿时的味道" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_1.png new file mode 100644 index 0000000000000000000000000000000000000000..37e74ba968083f6b3c736dd0b1f4ef224740c0b4 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_2.png new file mode 100644 index 0000000000000000000000000000000000000000..bb825b963ebb722b0f1fedd94c58977686d348c2 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_3.png new file mode 100644 index 0000000000000000000000000000000000000000..8b7dbbd738212e2b6ef403381ac237f2bf3c1bc6 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_city_rank_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_1.png new file mode 100644 index 0000000000000000000000000000000000000000..97c5cb7fb9efe84c90dd771d648682fc9e85d754 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ad1cfe89abe7d00f3f27d29d12a53a2caba1c2ea Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_3.png new file mode 100644 index 0000000000000000000000000000000000000000..ca56036c92c6d1b59d41c561b522d5d3f3bf4c02 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_4.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_4.png new file mode 100644 index 0000000000000000000000000000000000000000..43cfbc975e1a4ee06b1da50410129a5adf46df67 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_comment_4.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_down.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_down.svg new file mode 100644 index 0000000000000000000000000000000000000000..40f53926d7dbdf8013f41cd1a17df1a6e902f353 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_down.svg @@ -0,0 +1,15 @@ + + + ic_20_Max Pressure备份 + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_1.png new file mode 100644 index 0000000000000000000000000000000000000000..633dbf152732162ec4be8c9c46e48d2609baf9c4 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_2.png new file mode 100644 index 0000000000000000000000000000000000000000..9e2c535a443d0172a320951790782580bf7389b8 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_3.png new file mode 100644 index 0000000000000000000000000000000000000000..d8d7eb42c52211ae8fc0759ef94468851b0d18c6 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_food_rank_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_1.png new file mode 100644 index 0000000000000000000000000000000000000000..fa4593725ae5a6c4733aaf7e70e8a1f6d3264c30 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_2.png new file mode 100644 index 0000000000000000000000000000000000000000..f87ca572ef2972943a6ec3888e6e0bad6e848107 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_3.png new file mode 100644 index 0000000000000000000000000000000000000000..8d5bafd730354b7dce4d70bd675aa9733d08f575 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_fun_rank_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_1.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_1.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c443ae401f1a2d8694bc511a24e1494c5610d25c Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_1.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_2.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_2.PNG new file mode 100644 index 0000000000000000000000000000000000000000..7eae8521faae4e92965ea3d189f594608e8c007b Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_2.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_3.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_3.PNG new file mode 100644 index 0000000000000000000000000000000000000000..6eceb2c38548af068fc14e6982403b154ba5c5bd Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_3.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_4.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_4.PNG new file mode 100644 index 0000000000000000000000000000000000000000..8c289c45421e52e3f52f02aabe66895ce7c8852c Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_icon_4.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_1.png new file mode 100644 index 0000000000000000000000000000000000000000..bb93a14cfaff59f530f35dc5617d4a51f809363a Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_2.png new file mode 100644 index 0000000000000000000000000000000000000000..9189619df00613a9bb8bcc377dc3044c25ecad44 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_3.png new file mode 100644 index 0000000000000000000000000000000000000000..a0762fc8d791998fcfebb154dbe92bc14cb08c1c Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_news_rank_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_add.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_add.svg new file mode 100644 index 0000000000000000000000000000000000000000..1f6f21b4f518d7068bf39da34b81948f2b025da6 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_add.svg @@ -0,0 +1,24 @@ + + + Public/ic_public_add + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_back.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..6422ef95901649d4402e11bb3a77f1b3bb969763 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_back + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_1.png new file mode 100644 index 0000000000000000000000000000000000000000..94433f3de66426861e5fb32355bdce08f2a2b6d3 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_2.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_2.PNG new file mode 100644 index 0000000000000000000000000000000000000000..7f67bdb4f9b6dc7c062d5b737ba5d2e108308750 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_2.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_3.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_3.PNG new file mode 100644 index 0000000000000000000000000000000000000000..d46730110386306642263e166936df355236ee27 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_3.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_4.PNG b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_4.PNG new file mode 100644 index 0000000000000000000000000000000000000000..5f5c68ea26028376d3bc4772a399e741445501de Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_4.PNG differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_5.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_5.png new file mode 100644 index 0000000000000000000000000000000000000000..2f4d50975792dddb67a37504627df54c3ddf7ec8 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_rank_item_5.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle1.png new file mode 100644 index 0000000000000000000000000000000000000000..c154bf4ce1ede2b1ab76d94a388748add9621005 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle2.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1f48c2abb9c15499951edb75092ec61bd92042a7 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle2.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle3.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c743fffbde638107707801fb7740c530c4f6cdd2 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle3.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle4.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dfb5b410f8ee457c63b3367b9391f27e4524d956 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle4.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle5.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eaa682880b28b9a834d1ddb9e97344adc6ff13a2 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle5.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle6.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e7ffcdb5f5058f36e56f66c305df951769b83da Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle6.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle7.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..48b12f781efaa4838b7396eb1455771a85f93b05 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle7.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle8.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a8f2ac8fed4d716a09ec3216bb8610efbdc2a911 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle8.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle9.jpg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e3be34e2bdc99d1e90d5878624c3c05f4f715102 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_social_circle9.jpg differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_favor.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_favor.png new file mode 100644 index 0000000000000000000000000000000000000000..66a4b61e20b1e0c783318635b7bc26ffa0a3833f Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_favor.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_fire.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_fire.png new file mode 100644 index 0000000000000000000000000000000000000000..f79b24770d4ff453f09fdabc1ad87c451080742c Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_fire.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_new.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_new.png new file mode 100644 index 0000000000000000000000000000000000000000..5969d3db571fab147bf508689ec3323324699bdd Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_state_new.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_1.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_1.png new file mode 100644 index 0000000000000000000000000000000000000000..6b065c841bb6b0b531e7a7ab440363fe964b6721 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_1.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_2.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_2.png new file mode 100644 index 0000000000000000000000000000000000000000..334ff6937b527b46e66f841bf7406ef4bee59fcd Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_2.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_3.png b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_3.png new file mode 100644 index 0000000000000000000000000000000000000000..6ae87c1abefeb19f8a1198ab6a83a8fd7df55e01 Binary files /dev/null and b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_today_rank_3.png differ diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_heart.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_heart.svg new file mode 100644 index 0000000000000000000000000000000000000000..2bda46263404f167e2c7581a2cfffb886fa7ae33 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_heart.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_favor + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_share.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..6771dd917048029dea0e897f5fe7bd8c42879ccd --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_toolbar_share.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_share + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_up.svg b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_up.svg new file mode 100644 index 0000000000000000000000000000000000000000..ad576d6e5cc67e2ae313fa6e0367b712bd8f7711 --- /dev/null +++ b/MultiCommunityApplication/commons/base/src/main/resources/base/media/ic_up.svg @@ -0,0 +1,15 @@ + + + ic_20_Max Pressure + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/Index.ets b/MultiCommunityApplication/features/detail/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7e4e71f1d25398916b2d4efa7ad1acf50289916 --- /dev/null +++ b/MultiCommunityApplication/features/detail/Index.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 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 { DetailPage } from './src/main/ets/view/DetailPage'; + +export { CommentBarView } from './src/main/ets/view/CommentBarView'; + +export { MircoBlogView } from './src/main/ets/view/MircoBlogView'; + +export { CommentListView } from './src/main/ets/view/CommentListView'; + +export { default as CardArrayViewModel, CardArray } from './src/main/ets/viewmodel/CardArrayViewModel'; + +export { CardItem } from './src/main/ets/viewmodel/CardViewModel'; + +export { CommentInputView } from './src/main/ets/view/CommentInputView'; \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/build-profile.json5 b/MultiCommunityApplication/features/detail/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiCommunityApplication/features/detail/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/hvigorfile.ts b/MultiCommunityApplication/features/detail/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiCommunityApplication/features/detail/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/features/detail/obfuscation-rules.txt b/MultiCommunityApplication/features/detail/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/features/detail/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/oh-package.json5 b/MultiCommunityApplication/features/detail/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6bd13713c49637549ac065ea7537983f70fc8c3e --- /dev/null +++ b/MultiCommunityApplication/features/detail/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "detail", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "base": "file:../../commons/base" + } +} diff --git a/MultiCommunityApplication/features/detail/src/main/ets/constants/CommonConstants.ets b/MultiCommunityApplication/features/detail/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..14296736efd9650aa5d0ef35de3d348cd527b4a8 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 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 class CommonConstants { + /** + * Comment bar input width. + */ + static readonly COMMENT_BAR_INPUT_WIDTH: string = '40%'; + + /** + * Comment bar input margin left. + */ + static readonly COMMENT_BAR_INPUT_ML: string = '4.4%'; + + /** + * Text area max lines. + */ + static readonly TEXT_AREA_MAX_LINES: number = 8; + + /** + * Text area max length. + */ + static readonly TEXT_AREA_MAX_LENGTH: number = 500; + + /** + * Time position space. + */ + static readonly TIME_POSITION_SPACE: string = '8vp'; + + /** + * Review count space. + */ + static readonly REVIEW_COUNT_SPACE: string = '2vp'; + + /** + * Sub content max lines. + */ + static readonly SUB_CONTENT_MAX_LINES: number = 2; + + /** + * List item space. + */ + static readonly LIST_ITEM_SPACE: string = '8vp'; + + /** + * Max grid column. + */ + static readonly MAX_GRID_COLUMN: number = 3; + + /** + * Grid columns template. + */ + static readonly GRID_COLUMNS_TEMPLATE: string = '1fr 1fr 1fr'; + + /** + * Pinch gesture fingers. + */ + static readonly PINCH_GESTURE_FINGERS: number = 2; + + /** + * Suffix fp. + */ + static readonly SUFFIX_FP: string = 'fp'; + + /** + * Suffix vp. + */ + static readonly SUFFIX_VP: string = 'vp'; + + /** + * Max scale. + */ + static readonly MAX_SCALE: number = 1.45; + + /** + * Min scale. + */ + static readonly MIN_SCALE: number = 0.75; + + /** + * Content font size. + */ + static readonly CONTENT_FONT_SIZE: number = 16; + + /** + * Content font height. + */ + static readonly CONTENT_FONT_HEIGHT: number = 25.6; + + /** + * Picture margin top. + */ + static readonly PICTURE_MARGIN_TOP: number = 8; +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/CommentBarView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentBarView.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee6f3b1aff35c587b18edb7cc9cbe85f5edf4b1e --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentBarView.ets @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants as BaseCommon, BreakpointConstants as Breakpoint } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +const KEY_TEXTAREA: string = 'textarea_input'; +// [Start comment_bar_view] +@Component +export struct CommentBarView { + // [StartExclude comment_bar_view] + @StorageProp('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_LG; + @State isMouseClick: boolean = false; + @State content: string = ''; + isShowInput?: boolean = true; + isDarkMode: boolean = false; + jumpDetail: () => void = () => { + }; + // [EndExclude comment_bar_view] + + build() { + Column() { + Row() { + if (!this.isMouseClick) { + Row() { + Text($r('app.string.detail_write_comment')) + // [StartExclude comment_bar_view] + .fontSize($r('app.float.comment_context_fs')) + .fontWeight(FontWeight.Normal) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + .opacity($r('app.float.comment_context_opacity')) + // [EndExclude comment_bar_view] + } + .borderRadius($r('app.float.comment_context_br')) + .backgroundColor(this.isDarkMode ? $r('app.color.dark_mode_gbc') : $r('app.color.comment_context_bgc')) + .padding({ + left: $r('app.float.window_padding_left_sm') + }) + // [StartExclude comment_bar_view] + .justifyContent(FlexAlign.Start) + .height($r('app.float.comment_input_height')) + .width(Common.COMMENT_BAR_INPUT_WIDTH) + .margin({ left: Common.COMMENT_BAR_INPUT_ML }) + .visibility(this.isShowInput ? Visibility.Visible : Visibility.None) + // [EndExclude comment_bar_view] + .onMouse((event: MouseEvent) => { + if (event.button === MouseButton.Left && event.action === MouseAction.Press) { + this.isMouseClick = true; + } + }) + .onClick(() => { + if (!this.isMouseClick) { + AppStorage.setOrCreate('isShowInput', true); + } + }) + // [StartExclude comment_bar_view] + Row() { + Image(this.isDarkMode ? $r('app.media.ic_toolbar_comment_light') : $r('app.media.ic_toolbar_comment')) + .width($r('app.float.toolbar_comment_image_width')) + .aspectRatio(1) + .onClick(() => { + this.jumpDetail(); + }) + Image(this.isDarkMode ? $r('app.media.ic_toolbar_star_light') : $r('app.media.ic_toolbar_star')) + .width($r('app.float.toolbar_comment_image_width')) + .aspectRatio(1) + Image(this.isDarkMode ? $r('app.media.ic_toolbar_heart_light') : $r('app.media.ic_toolbar_heart')) + .width($r('app.float.toolbar_comment_image_width')) + .aspectRatio(1) + Image(this.isDarkMode ? $r('app.media.ic_toolbar_share_light') : $r('app.media.ic_toolbar_share')) + .width($r('app.float.toolbar_comment_image_width')) + .aspectRatio(1) + } + .layoutWeight(1) + .justifyContent(FlexAlign.SpaceAround) + // [EndExclude comment_bar_view] + } + else { + Row() { + TextArea({ placeholder: $r('app.string.detail_write_comment'), text: this.content }) + // [StartExclude comment_bar_view] + .fontColor(this.isDarkMode ? $r('app.color.font_color_dark') : $r('app.color.font_color_normal')) + .backgroundColor(this.isDarkMode ? $r('app.color.comment_context_bgc_dark') : + $r('app.color.comment_context_bgc')) + .maxLines(Common.TEXT_AREA_MAX_LINES) + .constraintSize({ + minHeight: $r('app.float.constraint_size') + }) + .enableKeyboardOnFocus(true) + .maxLength(Common.TEXT_AREA_MAX_LENGTH) + .showCounter(this.content.length === Common.TEXT_AREA_MAX_LENGTH ? true : false) + .layoutWeight(1) + .onChange((value: string) => { + this.content = value; + }) + .id(KEY_TEXTAREA) + .onAppear(() => { + focusControl.requestFocus(KEY_TEXTAREA) + }) + // [EndExclude comment_bar_view] + + Image(this.isDarkMode ? $r('app.media.ic_toolbar_send_white') : $r('app.media.ic_toolbar_sent')) + // [StartExclude comment_bar_view] + .width($r('app.float.toolbar_sent_width')) + .aspectRatio(1) + .margin({ + left: $r('app.float.toolbar_sent_ml'), + bottom: $r('app.float.toolbar_sent_mb') + }) + // [EndExclude comment_bar_view] + .onClick(() => { + this.isMouseClick = false; + }) + } + // [StartExclude comment_bar_view] + .width(BaseCommon.FULL_PERCENT) + .padding({ + left: $r('app.float.dialog_pl'), + right: $r('app.float.dialog_pr'), + top: $r('app.float.dialog_pt'), + bottom: $r('app.float.dialog_pt') + }) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Bottom) + .backgroundColor(this.isDarkMode ? Color.Transparent : $r('app.color.white')) + // [EndExclude comment_bar_view] + } + } + // [StartExclude comment_bar_view] + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.toolbar_comment_height')) + .borderWidth({ top: $r('app.float.comment_bar_border_with') }) + .borderColor(this.isDarkMode ? $r('app.color.title_board_color') : $r('app.color.comment_bar_border_color')) + // [EndExclude comment_bar_view] + } + // [StartExclude comment_bar_view] + .width(BaseCommon.FULL_PERCENT) + .height(this.getColumnHeight()) + // [EndExclude comment_bar_view] + } + // [StartExclude comment_bar_view] + getColumnHeight(): Resource { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_LG) { + return $r('app.float.toolbar_comment_height'); + } + return this.isShowInput ? $r('app.float.toolbar_comment_input_height') : $r('app.float.toolbar_comment_height'); + } + // [EndExclude comment_bar_view] +} +// [End comment_bar_view] \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/CommentInputView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentInputView.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb5c1014435f5c1d38949a556c47458c98ccc003 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentInputView.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants as BaseCommon } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +const TEXTAREA_KEY: string = 'textarea'; +const BUTTON_KEY: string = 'button'; + +@Component +export struct CommentInputView { + @State content: string = ''; + darkMode: boolean = true; + + build() { + Row() { + TextArea({ placeholder: $r('app.string.detail_write_comment'), text: this.content }) + .id(TEXTAREA_KEY) + .maxLines(Common.TEXT_AREA_MAX_LINES) + .constraintSize({ + minHeight: $r('app.float.constraint_size') + }) + .enableKeyboardOnFocus(true) + .maxLength(Common.TEXT_AREA_MAX_LENGTH) + .showCounter(this.content.length === Common.TEXT_AREA_MAX_LENGTH ? true : false) + .layoutWeight(1) + .onChange((value: string) => { + this.content = value; + }) + .onAppear(() => { + focusControl.requestFocus(TEXTAREA_KEY); + }) + + Image($r('app.media.ic_toolbar_sent')) + .width($r('app.float.toolbar_sent_width')) + .aspectRatio(1) + .margin({ + left: $r('app.float.toolbar_sent_ml'), + bottom: $r('app.float.toolbar_sent_mb') + }) + .id(BUTTON_KEY) + .onClick(() => { + AppStorage.setOrCreate('isShowInput', false); + focusControl.requestFocus(BUTTON_KEY); + }) + } + .width(BaseCommon.FULL_PERCENT) + .padding({ + left: $r('app.float.dialog_pl'), + right: $r('app.float.dialog_pr'), + top: $r('app.float.dialog_pt'), + bottom: $r('app.float.dialog_pt') + }) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Bottom) + .backgroundColor($r('app.color.white')) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/CommentItemView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentItemView.ets new file mode 100644 index 0000000000000000000000000000000000000000..8edde1ae51ce586b4ca6e5e48fe4adf9c4717a78 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentItemView.ets @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + CommentItemInterface, + CommonConstants as BaseCommon, + BreakpointType, + BreakpointConstants as Breakpoint +} from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +@Component +export struct CommentItemView { + @StorageLink('isFoldHorizontal') isFoldHorizontal: boolean = true; + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + commentItem: CommentItemInterface = {} as CommentItemInterface; + authorName: ResourceStr = ''; + isDarkMode: boolean = false; + + build() { + Column() { + Row() { + Row() { + Image(this.commentItem.icon) + .width($r('app.float.comment_item_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.comment_item_icon_br')) + + Text(this.commentItem.name) + .fontSize($r('app.float.comment_item_name_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .margin({ left: $r('app.float.comment_item_name_ml') }) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + + if (this.authorName === this.commentItem.name) { + Row() { + Text($r('app.string.author_type_name')) + .fontSize($r('app.float.author_type_name_fs')) + .fontWeight(FontWeight.Normal) + .fontColor(this.isDarkMode ? Color.White : $r('app.color.author_type_name_color')) + } + .borderColor(this.isDarkMode ? Color.White : $r('app.color.author_type_name_color')) + .borderRadius($r('app.float.author_type_name_br')) + .borderWidth($r('app.float.author_type_name_fw')) + .padding($r('app.float.author_type_name_padding')) + .margin({ left: $r('app.float.author_type_name_ml') }) + } + } + .height($r('app.float.comment_item_title_height')) + .justifyContent(FlexAlign.Start) + + Row() { + Text(`${this.commentItem.favorCount}`) + .fontSize($r('app.float.comment_item_favor_fs')) + .fontWeight(FontWeight.Normal) + .fontColor(this.isDarkMode ? $r('app.color.font_color_dark') : $r('app.color.comment_item_favor_color')) + + Image(this.isDarkMode ? $r('app.media.ic_comment_like') : $r('app.media.ic_public_favor')) + .width($r('app.float.comment_item_favor_width')) + .aspectRatio(1) + .margin({ left: $r('app.float.comment_item_favor_ml') }) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(BaseCommon.FULL_PERCENT) + + Text(this.commentItem.content) + .fontSize($r('app.float.comment_item_content_fs')) + .margin({ + left: $r('app.float.comment_item_content_ml') + }) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + + Row({ space: Common.TIME_POSITION_SPACE }) { + Text(this.commentItem.timePosition) + .fontSize($r('app.float.time_position_fs')) + .fontWeight(FontWeight.Normal) + .opacity($r('app.float.time_position_opacity')) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + + if (this.commentItem.reviewCnt) { + Row({ space: Common.REVIEW_COUNT_SPACE }) { + Text(`${this.commentItem.reviewCnt}`) + .fontSize($r('app.float.review_count_fs')) + .fontWeight(FontWeight.Normal) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + .opacity($r('app.float.review_count_opacity')) + + Text($r('app.string.replay')) + .fontSize($r('app.float.replay_fs')) + .fontWeight(FontWeight.Normal) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + .opacity($r('app.float.replay_opacity')) + } + .backgroundColor(this.isDarkMode ? $r('app.color.dark_mode_gbc') : $r('app.color.replay_bgc')) + .borderRadius($r('app.float.replay_board_radius')) + .padding({ + left: $r('app.float.replay_padding_left'), + right: $r('app.float.replay_padding_left') + }) + .height($r('app.float.replay_area_height')) + } else { + Text($r('app.string.replay')) + .fontSize($r('app.float.replay_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .opacity($r('app.float.replay_normal_opacity')) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + } + } + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.time_position_height')) + .justifyContent(FlexAlign.Start) + .margin({ + left: $r('app.float.comment_item_content_ml') + }) + + if (this.commentItem.reviewCnt) { + Column({ space: Common.REVIEW_COUNT_SPACE }) { + Text(this.commentItem.subContent) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + .fontSize($r('app.float.review_count_normal_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .maxLines(Common.SUB_CONTENT_MAX_LINES) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + + Text($r('app.string.read_all_replay')) + .fontSize($r('app.float.read_all_replay_fs')) + .fontColor(this.isDarkMode ? Color.White : $r('app.color.read_all_replay_fc')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + } + .backgroundColor(this.isDarkMode ? $r('app.color.dark_mode_gbc') : $r('app.color.read_all_replay_bgc')) + .borderRadius($r('app.float.read_all_replay_br')) + .margin({ + left: $r('app.float.comment_item_content_ml'), + right: new BreakpointType($r('app.float.read_all_replay_mr_sm'), + this.isFoldHorizontal ? $r('app.float.all_replay_mr_md_fold') : $r('app.float.all_replay_mr_md_normal'), + $r('app.float.replay_all_replay_mr_lg')) + .getValue(this.currentBreakpoint), + bottom: $r('app.float.sub_comment_margin_bottom') + }) + .alignItems(HorizontalAlign.Start) + .padding({ + left: $r('app.float.sub_content_pl'), + right: $r('app.float.sub_content_pl'), + top: $r('app.float.sub_content_pt'), + bottom: $r('app.float.sub_content_pt') + }) + } + } + .width(BaseCommon.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/CommentListView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentListView.ets new file mode 100644 index 0000000000000000000000000000000000000000..a27c24bfd11d3e09ab97362e0cbcb5632328cbab --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/CommentListView.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, CommentItemInterface, } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; +import { CommentItemView } from '../view/CommentItemView'; +import { CommentBarView } from '../view/CommentBarView'; +import { CardArray } from '../viewmodel/CardArrayViewModel'; +import CardArrayViewModel from '../viewmodel/CardArrayViewModel'; + +@Component +export struct CommentListView { + @StorageLink('isFoldHorizontal') isFoldHorizontal: boolean = true; + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('cardArrayViewModel') cardArrayViewModel: CardArray = CardArrayViewModel.getInstance(); + @StorageProp('selectCardIndex') selectCardIndex: number = 0; + focusHide?: boolean = false; + commentPadding?: ResourceStr; + isDarkMode: boolean = false; + + @Builder + itemHead() { + Row() { + Text($r('app.string.comment_list_title')) + .fontSize($r('app.float.comment_list_title_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .width(BaseCommon.FULL_PERCENT) + .fontColor(this.isDarkMode ? Color.White : Color.Black) + } + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.comment_list_title_height')) + .padding({ + top: $r('app.float.tab_bar_padding_top') + }) + } + + build() { + Column() { + Tabs({ barPosition: BarPosition.Start }) { + TabContent() { + List({ space: Common.LIST_ITEM_SPACE }) { + ForEach(this.cardArrayViewModel.cardArray[this.selectCardIndex].commentList, + (item: CommentItemInterface) => { + ListItem() { + CommentItemView({ + commentItem: item, + authorName: this.cardArrayViewModel.cardArray[this.selectCardIndex].name, + isDarkMode: this.isDarkMode + }) + } + }, (item: CommentItemInterface, index: number) => index + JSON.stringify(item)) + } + .nestedScroll({ + scrollForward: (this.isFoldHorizontal && this.currentBreakpoint === Breakpoint.BREAKPOINT_MD) ? + NestedScrollMode.PARENT_FIRST : NestedScrollMode.PARENT_FIRST, + scrollBackward: NestedScrollMode.SELF_FIRST + }) + .scrollBar(BarState.Off) + .edgeEffect(EdgeEffect.None) + .margin({ + top: $r('app.float.tab_content_margin_top') + }) + } + .tabBar(this.itemHead()) + .align(Alignment.Top) + } + .vertical(false) + .layoutWeight(1) + .padding({ + left: this.commentPadding ?? this.getPadding(), + right: this.commentPadding ?? this.getPadding() + }) + + CommentBarView() + .visibility(this.isShow() ? Visibility.Visible : Visibility.None) + } + .justifyContent(FlexAlign.End) + } + + isShow(): boolean { + if (this.focusHide) { + return false; + } + if ((this.currentBreakpoint === Breakpoint.BREAKPOINT_MD && this.isFoldHorizontal) || + (this.currentBreakpoint === Breakpoint.BREAKPOINT_LG)) { + return true; + } + return false; + } + + getPadding(): Resource { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_SM) { + return $r('app.float.window_padding_left_sm'); + } + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_MD) { + if (this.isFoldHorizontal) { + return $r('app.float.window_padding_left_sm'); + } else { + return $r('app.float.window_padding_left_md'); + } + } + return $r('app.float.window_padding_left_lg'); + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/DetailPage.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/DetailPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f57f8257bf936f9e3566697d018c9cea3586355 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/DetailPage.ets @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as Common, BreakpointType } from 'base'; +import { DetailTitleView } from './DetailTitleView'; +import { MircoBlogView } from './MircoBlogView'; +import { CommentListView } from './CommentListView'; +import { CommentBarView } from './CommentBarView'; +import { CommentInputView } from './CommentInputView'; +import { CardArray } from '../viewmodel/CardArrayViewModel'; +import { CardItem } from '../viewmodel/CardViewModel'; +import CardArrayViewModel from '../viewmodel/CardArrayViewModel'; + +const KEY_BACKGROUND: string = 'background'; +// [Start detail_page] +@Component +export struct DetailPage { + // [StartExclude detail_page] + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('isFoldHorizontal') isFoldHorizontal: boolean = true; + @StorageLink('cardArrayViewModel') cardArrayViewModel: CardArray = CardArrayViewModel.getInstance(); + @StorageLink('selectCardIndex') selectCardIndex: number = 0; + @StorageLink('isDetailPage') isDetailPage: boolean = false; + @StorageLink('isShowInput') isShowInput: boolean = false; + @State cardItem: CardItem = this.cardArrayViewModel.cardArray[this.selectCardIndex]; + isShowedButton?: boolean = true; + + aboutToAppear() { + this.isDetailPage = true; + } + // [EndExclude detail_page] + build() { + Stack() { + Column() { + DetailTitleView({ isShowedButton: this.isShowedButton }) + Scroll() { + GridRow({ + columns: { + sm: Breakpoint.GRID_ROW_COLUMNS[2], + md: Breakpoint.GRID_ROW_COLUMNS[3], + lg: Breakpoint.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ + span: { + sm: Breakpoint.GRID_COLUMN_SPANS[5], + md: this.isFoldHorizontal ? Breakpoint.GRID_COLUMN_SPANS[4] : Breakpoint.GRID_COLUMN_SPANS[3], + lg: Breakpoint.GRID_COLUMN_SPANS[0] + } + }) { + if ((this.isFoldHorizontal && this.currentBreakpoint === Breakpoint.BREAKPOINT_MD)) { + Scroll() { + MircoBlogView({ + cardItem: this.cardItem, + index: this.selectCardIndex + }) + // [StartExclude detail_page] + .margin({ + top: $r('app.float.mirco_blog_mt') + }) + // [EndExclude detail_page] + } + // [StartExclude detail_page] + .scrollBar(BarState.Off) + .align(Alignment.Top) + .layoutWeight(1) + // [EndExclude detail_page] + } else { + MircoBlogView({ + cardItem: this.cardItem, + index: this.selectCardIndex + }) + // [StartExclude detail_page] + .margin({ + top: $r('app.float.mirco_blog_mt') + }) + // [EndExclude detail_page] + } + } + // [StartExclude detail_page] + .width(Common.FULL_PERCENT) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint) + }) + // [EndExclude detail_page] + + GridCol({ + span: { + sm: Breakpoint.GRID_COLUMN_SPANS[5], + md: this.isFoldHorizontal ? Breakpoint.GRID_COLUMN_SPANS[6] : Breakpoint.GRID_COLUMN_SPANS[3], + lg: Breakpoint.GRID_COLUMN_SPANS[0] + } + }) { + CommentListView() + } + // [StartExclude detail_page] + .height(Common.FULL_PERCENT) + .width(Common.FULL_PERCENT) + // [EndExclude detail_page] + } + } + .visibility(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? Visibility.None : Visibility.Visible) + // [StartExclude detail_page] + .layoutWeight(1) + .scrollBar(BarState.Off) + + CommentBarView() + .visibility(this.isShow() ? Visibility.Visible : Visibility.None) + // [EndExclude detail_page] + + Column() { + SideBarContainer() { + Column() { + CommentListView() + } + // [StartExclude detail_page] + .backgroundColor($r('app.color.acetate')) + // [EndExclude detail_page] + + Column() { + Scroll() { + MircoBlogView({ + cardItem: this.cardItem, + index: this.selectCardIndex + }) + // [StartExclude detail_page] + .margin({ + top: $r('app.float.mirco_blog_mt') + }) + // [EndExclude detail_page] + } + // [StartExclude detail_page] + .padding({ + left: $r('app.float.window_padding_left_lg'), + right: $r('app.float.window_padding_left_lg') + }) + .scrollBar(BarState.Off) + // [EndExclude detail_page] + } + .justifyContent(FlexAlign.Start) + + } + // [StartExclude detail_page] + .sideBarPosition(SideBarPosition.End) + .showControlButton(false) + .sideBarWidth($r('app.float.side_bar_with')) + .minSideBarWidth($r('app.float.min_side_bar_width')) + .maxSideBarWidth($r('app.float.max_side_bar_width')) + .autoHide(false) + .divider(null) + // [EndExclude detail_page] + } + .visibility(this.currentBreakpoint !== Breakpoint.BREAKPOINT_LG ? Visibility.None : Visibility.Visible) + // [StartExclude detail_page] + .width(Common.FULL_PERCENT) + .layoutWeight(1) + // [EndExclude detail_page] + } + // [StartExclude detail_page] + + .height(Common.FULL_PERCENT) + .justifyContent(FlexAlign.End) + .expandSafeArea([SafeAreaType.KEYBOARD, SafeAreaType.SYSTEM]) + + if (this.isShowInput) { + Stack() { + Column() + .justifyContent(FlexAlign.End) + .width(Common.FULL_PERCENT) + .height(Common.FULL_PERCENT) + .backgroundColor(Color.Black) + .opacity($r('app.float.text_input_bgc_opacity')) + .id(KEY_BACKGROUND) + .onClick(() => { + AppStorage.setOrCreate('isShowInput', false); + focusControl.requestFocus(KEY_BACKGROUND); + }) + + CommentInputView() + } + .alignContent(Alignment.Bottom) + } + // [EndExclude detail_page] + } + } + // [StartExclude detail_page] + isShow(): boolean { + if ((this.currentBreakpoint === Breakpoint.BREAKPOINT_MD && !this.isFoldHorizontal) || + (this.currentBreakpoint === Breakpoint.BREAKPOINT_SM)) { + return true; + } + return false; + } + // [EndExclude detail_page] +} +// [End detail_page] \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/DetailTitleView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/DetailTitleView.ets new file mode 100644 index 0000000000000000000000000000000000000000..f74bc4fd2823fceffa38550d13be106e4c372fe4 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/DetailTitleView.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants as Breakpoint, BreakpointType, CommonConstants as BaseCommon } from 'base'; + +@Component +export struct DetailTitleView { + @StorageLink('currentBreakpoint') @Watch('checkFoldable') currentBreakpoint: string = Breakpoint.BREAKPOINT_LG; + @StorageLink('isFoldHorizontal') isFoldHorizontal: boolean = true; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @State foldable: boolean = this.currentBreakpoint === Breakpoint.BREAKPOINT_MD; + isShowedButton?: boolean = true; + + checkFoldable() { + this.foldable = this.currentBreakpoint === Breakpoint.BREAKPOINT_MD; + } + + build() { + Column() { + Blank() + .height(deviceInfo.deviceType !== BaseCommon.DEVICE_2IN1 ? $r("app.float.title_blank_height") : + $r('app.float.blank_top_height')) + .width(BaseCommon.FULL_PERCENT) + + Row() { + Stack() { + Row() { + Text($r('app.string.card_detail_title')) + .height(BaseCommon.FULL_PERCENT) + .fontSize($r('app.float.card_detail_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + } + .width(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + + Row() { + Image($r('app.media.ic_public_back')) + .margin({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint) + }) + .width($r('app.float.card_detail_back_width')) + .aspectRatio(1) + .onClick(() => { + this.pageInfos.pop(); + AppStorage.setOrCreate('isDetailPage', false); + }) + + Image(this.isFoldHorizontal ? $r('app.media.ic_fold_horizontal') : $r('app.media.ic_fold_vertical')) + .margin({ right: $r("app.float.card_detail_fold_mr") }) + .width($r('app.float.card_detail_more_width')) + .aspectRatio(1) + .visibility(this.isShowedButton && this.foldable ? Visibility.Visible : Visibility.Hidden) + .onClick(() => { + this.isFoldHorizontal = !this.isFoldHorizontal; + }) + } + .width(BaseCommon.FULL_PERCENT) + .height(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + .height(BaseCommon.FULL_PERCENT) + } + .height($r('app.float.detail_title_height')) + } + .width(BaseCommon.FULL_PERCENT) + .backgroundColor($r('app.color.card_detail_title_bgc')) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/view/MircoBlogView.ets b/MultiCommunityApplication/features/detail/src/main/ets/view/MircoBlogView.ets new file mode 100644 index 0000000000000000000000000000000000000000..ffe1fbd1c5474bd70a49ed540c3703b9767db68f --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/view/MircoBlogView.ets @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CardItemInterface, BreakpointConstants as Breakpoint, CommonConstants as BaseCommon } from 'base'; +import { CardItem } from '../viewmodel/CardViewModel'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +interface ImageInfo { + width: number; + height: number; + componentWidth: number; + componentHeight: number; + loadingStatus: number; + contentWidth: number; + contentHeight: number; + contentOffsetX: number; + contentOffsetY: number; +} +// [Start mirco_blog_view] +@Component +export struct MircoBlogView { + // [StartExclude mirco_blog_view] + @StorageProp('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_LG; + @StorageLink('isDetailPage') isDetailPage: boolean = false; + @StorageLink('isPictureDetail') isPictureDetail: boolean = false; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @State index: number = 0; + @State cardItem: CardItem = new CardItem({} as CardItemInterface, 0); + @State showPicture: boolean = true; + @State imageWidth: string = BaseCommon.FULL_PERCENT; + @State contentFontSize: number = Common.CONTENT_FONT_SIZE; + @State contentFontHeight: number = Common.CONTENT_FONT_HEIGHT; + @State scaleValue: number = 1; + @State pinchValue: number = 1; + @State pictureMarginTop: number = Common.PICTURE_MARGIN_TOP; + isDarkMode: boolean = false; + jumpDetail: () => void = () => { + }; + + jump(index: number) { + AppStorage.setOrCreate('selectCardIndex', this.index); + this.pageInfos.pushPath({ name: 'pictureDetail', param: index }); + } + // [EndExclude mirco_blog_view] + build() { + Column() { + if (this.cardItem !== undefined) { + // [StartExclude mirco_blog_view] + Row() { + Row() { + Image(this.cardItem.icon) + .width($r('app.float.blog_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.blog_icon_br')) + + Column() { + Text(this.cardItem.name) + .fontSize($r('app.float.blog_name_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .height($r('app.float.blog_name_height')) + .fontColor(this.isDarkMode ? $r('app.color.card_item_name_fc_dark') : Color.Black) + + Text(this.cardItem.authorType) + .fontWeight(FontWeight.Normal) + .fontSize($r('app.float.author_type_fs')) + .fontColor(this.isDarkMode ? $r('app.color.author_type_fc_dark') : $r('app.color.author_type_color')) + .height($r('app.float.author_type_height')) + } + .margin({ left: $r('app.float.blog_title_ml') }) + .justifyContent(FlexAlign.Start) + .alignItems(HorizontalAlign.Start) + } + .justifyContent(FlexAlign.Start) + + Row() { + Image(this.isDarkMode ? $r('app.media.ic_public_add_white') : $r('app.media.ic_public_add')) + .width($r('app.float.blog_add_width')) + .aspectRatio(1) + + Text($r('app.string.blog_follow')) + .fontSize($r('app.float.follow_font_size')) + .margin({ left: $r('app.float.follow_margin_left') }) + .fontColor(this.isDarkMode ? Color.White : $r('app.color.follow_font_color')) + } + .borderRadius($r('app.float.blog_title_follow_br')) + .backgroundColor(this.isDarkMode ? $r('app.color.dark_mode_gbc') : $r('app.color.replay_bgc')) + .padding({ + left: $r('app.float.blog_title_padding_left'), + right: $r('app.float.blog_title_padding_left') + }) + .width($r('app.float.blog_title_follow_width')) + .height($r('app.float.blog_title_follow_height')) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(BaseCommon.FULL_PERCENT) + .padding({ + top: $r('app.float.card_title_padding'), + bottom: $r('app.float.card_title_padding') + }) + // [EndExclude mirco_blog_view] + Row() { + Text(this.cardItem.content) + .fontSize(`${this.contentFontSize}${Common.SUFFIX_FP}`) + .lineHeight(`${this.contentFontHeight}${Common.SUFFIX_VP}`) + // [StartExclude mirco_blog_view] + .width(BaseCommon.FULL_PERCENT) + .onClick(() => { + this.jumpDetail(); + }) + .fontColor(this.isDarkMode ? $r('app.color.card_item_content_fc_dark') : Color.Black) + .copyOption(CopyOptions.LocalDevice) + // [EndExclude mirco_blog_view] + } + .gesture( + PinchGesture({ fingers: Common.PINCH_GESTURE_FINGERS }) + .onActionUpdate((event?: GestureEvent) => { + if (event && (this.isDetailPage || this.isPictureDetail)) { + let tmp = this.pinchValue * event.scale; + if (tmp > Common.MAX_SCALE) { + tmp = Common.MAX_SCALE; + } + if (tmp < Common.MIN_SCALE) { + tmp = Common.MIN_SCALE; + } + this.scaleValue = tmp; + this.contentFontSize = Common.CONTENT_FONT_SIZE * this.scaleValue; + this.contentFontHeight = Common.CONTENT_FONT_HEIGHT * this.scaleValue; + this.pictureMarginTop = Common.PICTURE_MARGIN_TOP * (this.scaleValue > 1 ? this.scaleValue : 1); + } + }) + .onActionEnd(() => { + this.pinchValue = this.scaleValue; + }) + ) + // [StartExclude mirco_blog_view] + if (this.showPicture) { + if (this.cardItem.pictureArray.length === 1) { + Image(this.cardItem.pictureArray[0]) + .onComplete((event: ImageInfo) => { + if (event.width < event.height) { + this.imageWidth = BaseCommon.HALF_PERCENT; + } + }) + .width(this.imageWidth) + .onClick(() => { + this.jump(0); + }) + .margin({ top: `${this.pictureMarginTop}${Common.SUFFIX_VP}` }) + } else { + Grid() { + ForEach(this.cardItem.pictureArray, (item: Resource, index: number) => { + GridItem() { + Image(item) + .width(BaseCommon.FULL_PERCENT) + .aspectRatio(1) + .onClick(() => { + this.jump(index); + }) + .autoResize(true) + } + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .columnsTemplate(Common.GRID_COLUMNS_TEMPLATE) + .columnsGap($r('app.float.grid_gap')) + .rowsGap($r('app.float.grid_gap')) + .width(BaseCommon.FULL_PERCENT) + .aspectRatio(this.getAspectRatio(this.cardItem.pictureArray.length)) + .margin({ top: `${this.pictureMarginTop}${Common.SUFFIX_VP}` }) + } + } + // [EndExclude mirco_blog_view] + } + } + // [StartExclude mirco_blog_view] + .alignItems(HorizontalAlign.Start) + .flexShrink(1) + .width(BaseCommon.FULL_PERCENT) + // [EndExclude mirco_blog_view] + } + // [StartExclude mirco_blog_view] + getAspectRatio(length: number): number { + let rowNumber: number = (length % Common.MAX_GRID_COLUMN === 0) ? length / Common.MAX_GRID_COLUMN : + (Math.floor(length / Common.MAX_GRID_COLUMN) + 1); + return Common.MAX_GRID_COLUMN / rowNumber; + } + // [EndExclude mirco_blog_view] +} +// [End mirco_blog_view] \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardArrayViewModel.ets b/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardArrayViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..4db56c718dd0dc4d11de1d51f0ee7d90c379ce0b --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardArrayViewModel.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CardItemInterface, CARD_LIST } from 'base'; +import { CardItem } from './CardViewModel'; + +export class CardArray { + cardArray: CardItem[] = []; + + constructor() { + CARD_LIST.forEach((item: CardItemInterface, index: number) => { + this.cardArray.push(new CardItem(item, index)); + }); + } + + getInstance() { + return this; + } +} + +export default new CardArray(); \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardViewModel.ets b/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..6319546465a1838c3843114f7873dc75ebd79a2b --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/ets/viewmodel/CardViewModel.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { COMMENT_LIST, CommentItemInterface, CardItemInterface, CommentItem, PICTURE_ARRAY_LIST } from 'base'; + +export class CardItem implements CardItemInterface { + icon: ResourceStr; + name: ResourceStr; + authorType: ResourceStr; + content: ResourceStr; + pictureArray: Resource[] = []; + commentList: CommentItem[] = []; + + constructor(card: CardItemInterface, index: number) { + this.icon = card.icon; + this.name = card.name; + this.authorType = card.authorType; + this.content = card.content; + this.pictureArray = PICTURE_ARRAY_LIST[index % PICTURE_ARRAY_LIST.length]; + + COMMENT_LIST.forEach((item: CommentItemInterface) => { + this.commentList.push(new CommentItem(item)); + }); + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/module.json5 b/MultiCommunityApplication/features/detail/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e31989607abace49b9a3a5d8b3f4db87609e2c49 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "detail", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/element/color.json b/MultiCommunityApplication/features/detail/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d8d5403499e38a65f1f2f99594d966bfc33f741c --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/element/color.json @@ -0,0 +1,88 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "acetate", + "value": "#00000000" + }, + { + "name": "comment_bar_border_color", + "value": "#0D000000" + }, + { + "name": "comment_item_favor_color", + "value": "#99000000" + }, + { + "name": "card_detail_title_bgc", + "value": "#F2F2F2" + }, + { + "name": "author_type_color", + "value": "#80000000" + }, + { + "name": "follow_font_color", + "value": "#0A59F7" + }, + { + "name": "blog_title_follow_bc", + "value": "#0859F7" + }, + { + "name": "author_type_name_color", + "value": "#CC0A59F7" + }, + { + "name": "replay_bgc", + "value": "#0D000000" + }, + { + "name": "read_all_replay_fc", + "value": "#0A59F7" + }, + { + "name": "read_all_replay_bgc", + "value": "#08000000" + }, + { + "name": "comment_context_bgc", + "value": "#0D000000" + }, + { + "name": "comment_context_bgc_dark", + "value": "#0DFFFFFF" + }, + { + "name": "dark_mode_gbc", + "value": "#26282A" + }, + { + "name": "font_color_dark", + "value": "#99FFFFFF" + }, + { + "name": "font_color_normal", + "value": "#99000000" + }, + { + "name": "title_board_color", + "value": "#26282A" + }, + { + "name": "card_item_content_fc_dark", + "value": "#CCFFFFFF" + }, + { + "name": "card_item_name_fc_dark", + "value": "#E6FFFFFF" + }, + { + "name": "author_type_fc_dark", + "value": "#80FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/element/float.json b/MultiCommunityApplication/features/detail/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..7c18f56efabaeeda900f7ea21ed43c675ac57242 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/element/float.json @@ -0,0 +1,392 @@ +{ + "float": [ + { + "name": "float_1", + "value": "30.6" + }, + { + "name": "side_bar_with", + "value": "480vp" + }, + { + "name": "min_side_bar_width", + "value": "480vp" + }, + { + "name": "max_side_bar_width", + "value": "480vp" + }, + { + "name": "comment_input_height", + "value": "40vp" + }, + { + "name": "toolbar_comment_image_width", + "value": "24vp" + }, + { + "name": "toolbar_comment_height", + "value": "56vp" + }, + { + "name": "toolbar_comment_input_height", + "value": "84vp" + }, + { + "name": "comment_bar_border_with", + "value": "0.5vp" + }, + { + "name": "constraint_size", + "value": "40vp" + }, + { + "name": "toolbar_sent_width", + "value": "24vp" + }, + { + "name": "toolbar_sent_ml", + "value": "16vp" + }, + { + "name": "toolbar_sent_mb", + "value": "8vp" + }, + { + "name": "dialog_pl", + "value": "12vp" + }, + { + "name": "dialog_pr", + "value": "16vp" + }, + { + "name": "dialog_pt", + "value": "8vp" + }, + { + "name": "comment_item_icon_width", + "value": "32vp" + }, + { + "name": "comment_item_icon_br", + "value": "16vp" + }, + { + "name": "comment_item_name_fs", + "value": "14fp" + }, + { + "name": "comment_item_name_ml", + "value": "12vp" + }, + { + "name": "comment_item_title_height", + "value": "39vp" + }, + { + "name": "comment_item_favor_fs", + "value": "12fp" + }, + { + "name": "comment_item_favor_width", + "value": "16vp" + }, + { + "name": "comment_item_favor_ml", + "value": "4vp" + }, + { + "name": "comment_item_title_pl", + "value": "16vp" + }, + { + "name": "comment_item_content_fs", + "value": "14fp" + }, + { + "name": "comment_item_content_ml", + "value": "44vp" + }, + { + "name": "comment_item_content_mr", + "value": "16vp" + }, + { + "name": "comment_list_title_fs", + "value": "18fp" + }, + { + "name": "comment_list_title_pl", + "value": "16vp" + }, + { + "name": "comment_list_title_height", + "value": "56vp" + }, + { + "name": "card_detail_fs", + "value": "20fp" + }, + { + "name": "card_detail_back_ml", + "value": "16vp" + }, + { + "name": "card_detail_back_width", + "value": "24vp" + }, + { + "name": "card_detail_fold_mr", + "value": "16vp" + }, + { + "name": "card_detail_more_width", + "value": "24vp" + }, + { + "name": "title_blank_height", + "value": "36vp" + }, + { + "name": "detail_title_height", + "value": "40vp" + }, + { + "name": "blog_icon_width", + "value": "36vp" + }, + { + "name": "blog_icon_br", + "value": "18vp" + }, + { + "name": "blog_name_fs", + "value": "14fp" + }, + { + "name": "blog_name_height", + "value": "19fp" + }, + { + "name": "author_type_fs", + "value": "12fp" + }, + { + "name": "author_type_height", + "value": "16vp" + }, + { + "name": "blog_title_ml", + "value": "8vp" + }, + { + "name": "blog_add_width", + "value": "12vp" + }, + { + "name": "follow_font_size", + "value": "12fp" + }, + { + "name": "follow_margin_left", + "value": "5vp" + }, + { + "name": "blog_title_follow_bw", + "value": "1vp" + }, + { + "name": "blog_title_follow_br", + "value": "14vp" + }, + { + "name": "blog_title_padding_left", + "value": "13vp" + }, + { + "name": "blog_title_follow_height", + "value": "28vp" + }, + { + "name": "blog_title_follow_width", + "value": "64vp" + }, + { + "name": "blog_title_height", + "value": "52vp" + }, + { + "name": "blog_margin_left", + "value": "16vp" + }, + { + "name": "blog_margin_top", + "value": "8vp" + }, + { + "name": "author_type_name_fs", + "value": "10fp" + }, + { + "name": "author_type_name_br", + "value": "4vp" + }, + { + "name": "author_type_name_fw", + "value": "0.5vp" + }, + { + "name": "author_type_name_padding", + "value": "2vp" + }, + { + "name": "author_type_name_ml", + "value": "4vp" + }, + { + "name": "time_position_fs", + "value": "12fp" + }, + { + "name": "time_position_opacity", + "value": "0.4" + }, + { + "name": "review_count_fs", + "value": "12fp" + }, + { + "name": "review_count_opacity", + "value": "0.6" + }, + { + "name": "replay_fs", + "value": "12fp" + }, + { + "name": "replay_opacity", + "value": "0.6" + }, + { + "name": "replay_board_radius", + "value": "13vp" + }, + { + "name": "replay_padding_left", + "value": "8vp" + }, + { + "name": "replay_area_height", + "value": "24vp" + }, + { + "name": "replay_normal_opacity", + "value": "0.9" + }, + { + "name": "time_position_height", + "value": "40vp" + }, + { + "name": "review_count_normal_fs", + "value": "14fp" + }, + { + "name": "read_all_replay_fs", + "value": "12fp" + }, + { + "name": "read_all_replay_br", + "value": "8vp" + }, + { + "name": "read_all_replay_mr_sm", + "value": "16vp" + }, + { + "name": "all_replay_mr_md_fold", + "value": "32vp" + }, + { + "name": "all_replay_mr_md_normal", + "value": "24vp" + }, + { + "name": "replay_all_replay_mr_lg", + "value": "40vp" + }, + { + "name": "sub_content_pl", + "value": "16vp" + }, + { + "name": "sub_content_pt", + "value": "12vp" + }, + { + "name": "picture_are_margin_top", + "value": "8vp" + }, + { + "name": "window_padding_left_sm", + "value": "16vp" + }, + { + "name": "window_padding_left_md", + "value": "24vp" + }, + { + "name": "window_padding_left_lg", + "value": "32vp" + }, + { + "name": "mirco_blog_mt", + "value": "16vp" + }, + { + "name": "comment_padding_sm", + "value": "16vp" + }, + { + "name": "blank_top_height", + "value": "24vp" + }, + { + "name": "card_title_padding", + "value": "8vp" + }, + { + "name": "grid_gap", + "value": "4vp" + }, + { + "name": "comment_context_fs", + "value": "16fp" + }, + { + "name": "comment_context_opacity", + "value": "0.6" + }, + { + "name": "comment_context_br", + "value": "20vp" + }, + { + "name": "text_input_bgc_opacity", + "value": "0.4" + }, + { + "name": "sub_comment_margin_bottom", + "value": "8vp" + }, + { + "name": "tab_bar_padding_top", + "value": "22vp" + }, + { + "name": "tab_content_margin_top", + "value": "7vp" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/element/string.json b/MultiCommunityApplication/features/detail/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f32baca2ce6e1f4365aba5c8c87992c30011e86b --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "detail_write_comment", + "value": "写评论" + }, + { + "name": "comment_list_title", + "value": "评论" + }, + { + "name": "card_detail_title", + "value": "详情页" + }, + { + "name": "blog_follow", + "value": "关注" + }, + { + "name": "author_type_name", + "value": "楼主" + }, + { + "name": "replay", + "value": "回复" + }, + { + "name": "read_all_replay", + "value": "查看全部回复" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_comment_like.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_comment_like.svg new file mode 100644 index 0000000000000000000000000000000000000000..2425ceb32d040f57df1bd764d771645b73d90ed3 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_comment_like.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_horizontal.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_horizontal.svg new file mode 100644 index 0000000000000000000000000000000000000000..477d23b91ac89d452510661260272177193b81cd --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_horizontal.svg @@ -0,0 +1,14 @@ + + + qieHuang + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_vertical.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_vertical.svg new file mode 100644 index 0000000000000000000000000000000000000000..1df28f042a934e4e8d7e9e38b42ec4a6cd8d3881 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_fold_vertical.svg @@ -0,0 +1,15 @@ + + + Public_ic_public_view_list备份 + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_add_white.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_add_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..fcb26b9c1080ac600c2c7129f03d93c948ee6864 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_add_white.svg @@ -0,0 +1,24 @@ + + + Public/ic_public_add + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_favor.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_favor.svg new file mode 100644 index 0000000000000000000000000000000000000000..aaf51d2ab16da86838e73f0b67adc01bcfa81020 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_public_favor.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment.svg new file mode 100644 index 0000000000000000000000000000000000000000..83497d66b06b901e065afeb294ceabffaa703bb7 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment.svg @@ -0,0 +1,10 @@ + + + light _ ic_toolbar_comment_number_2 + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment_light.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment_light.svg new file mode 100644 index 0000000000000000000000000000000000000000..8886c6e412209ccbdbef85fb4218fa7969aa2686 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_comment_light.svg @@ -0,0 +1,10 @@ + + + light _ ic_toolbar_comment_number_2 + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_heart_light.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_heart_light.svg new file mode 100644 index 0000000000000000000000000000000000000000..affc85c68dba924663f888dee7b4b689b632331b --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_heart_light.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_favor + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_send_white.png b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_send_white.png new file mode 100644 index 0000000000000000000000000000000000000000..664c28d202ab69c956d86918af74a5a41b3a9a8d Binary files /dev/null and b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_send_white.png differ diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_sent.png b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_sent.png new file mode 100644 index 0000000000000000000000000000000000000000..03dd43a0a71d753e26894cf8ff04533a33073055 Binary files /dev/null and b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_sent.png differ diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_share_light.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_share_light.svg new file mode 100644 index 0000000000000000000000000000000000000000..8ce680b660ee72eac3bde09cb5b7225581864e59 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_share_light.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_share + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star.svg new file mode 100644 index 0000000000000000000000000000000000000000..9c24c0d7887e04c6bce16db33a7a6678cb07eb07 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_collect + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star_light.svg b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star_light.svg new file mode 100644 index 0000000000000000000000000000000000000000..8fae2e4c7fc7085ff7e4e01e255af312c5d7b5a8 --- /dev/null +++ b/MultiCommunityApplication/features/detail/src/main/resources/base/media/ic_toolbar_star_light.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_collect + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/Index.ets b/MultiCommunityApplication/features/hot/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ccf5e689b35c16fc50a28ca2eb94554ff4ceb11 --- /dev/null +++ b/MultiCommunityApplication/features/hot/Index.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 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 { HotPointPage } from './src/main/ets/view/HotPointPage'; diff --git a/MultiCommunityApplication/features/hot/build-profile.json5 b/MultiCommunityApplication/features/hot/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiCommunityApplication/features/hot/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/hvigorfile.ts b/MultiCommunityApplication/features/hot/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiCommunityApplication/features/hot/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/features/hot/obfuscation-rules.txt b/MultiCommunityApplication/features/hot/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/features/hot/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/oh-package.json5 b/MultiCommunityApplication/features/hot/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..20150c2c55588879242004ba7bcd57f04bdc4af2 --- /dev/null +++ b/MultiCommunityApplication/features/hot/oh-package.json5 @@ -0,0 +1,15 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "hot", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "rank": "file:../rank", + "base": "file:../../commons/base", + "detail": "file:../detail" + } +} diff --git a/MultiCommunityApplication/features/hot/src/main/ets/constants/CommonConstants.ets b/MultiCommunityApplication/features/hot/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..71819aa7582f462742691a5f78bd8246604b6979 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2023 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 class CommonConstants { + /** + * Rank item margin left sm. + */ + static readonly RANK_ITEM_ML_SM: string = '2.2%'; + + /** + * Rank item margin left md. + */ + static readonly RANK_ITEM_ML_MD: string = '1.2%'; + + /** + * Rank item margin left lg. + */ + static readonly RANK_ITEM_ML_LG: string = '1.2%'; + + /** + * Rank title margin left. + */ + static readonly RANK_TITLE_MARGIN_LEFT: string = '2.2%'; + + /** + * Search bar width md. + */ + static readonly SEARCH_BAR_WIDTH_MD: string = '27.2%'; + + /** + *Search bar width lg. + */ + static readonly SEARCH_BAR_WIDTH_LG: string = '18.1%'; + + /** + * Animation duration. + */ + static readonly TAB_ANIMATION_DURATION: number = 300; + + /** + * Water flow columns template normal. + */ + static readonly WATER_FLOW_COLUMNS_TEMPLATE_NORMAL: string = '1fr'; + + /** + * Water flow columns template lg. + */ + static readonly WATER_FLOW_COLUMNS_TEMPLATE_LG: string = '1fr 1fr'; + + /** + * Hot column item space sm. + */ + static readonly HOT_COLUMN_IS_SM:string = '0vp'; + + /** + * Hot column item space md. + */ + static readonly HOT_COLUMN_IS_MD:string = '49vp'; + + /** + * Hot column item space lg. + */ + static readonly HOT_COLUMN_IS_LG:string = '81vp'; + + /** + * Swiper display count one. + */ + static readonly SWIPER_DISPLAY_COUNT_ONE: number = 1; + + /** + * Swiper display count two. + */ + static readonly SWIPER_DISPLAY_COUNT_TWO: number = 2; + + /** + * Swiper display count three. + */ + static readonly SWIPER_DISPLAY_COUNT_THREE: number = 3; + + /** + * Hot column max count. + */ + static readonly HOT_COLUMN_MAX_COUNT: number = 5; + + /** + * Hot item column space. + */ + static readonly HOT_ITEM_COLUMN_SPACE: string = '4vp'; + + /** + * Top count. + */ + static readonly TOP_COUNT: number = 3; + + /** + * Search bar opacity. + */ + static readonly SEARCH_BAR_OPACITY: number = 0.9; + + /** + * Card item shadow radius. + */ + static readonly CARD_ITEM_SHADOW_RADIUS: number = 10; + + /** + * Icon more opacity. + */ + static readonly ICON_MORE_OPACITY: number = 0.4; + + /** + * Window padding sm. + */ + static readonly WINDOW_PADDING_SM: string = '16vp'; + + /** + * Window padding md. + */ + static readonly WINDOW_PADDING_MD: string = '23vp'; + + /** + * Window padding lg. + */ + static readonly WINDOW_PADDING_LG: string = '32vp'; + + /** + * Linear gradient angel. + */ + static readonly LINEAR_GRADIENT_ANGEL: number = 180; + + /** + * Linear gradient from color. + */ + static readonly LINEAR_GRADIENT_FROM_COLOR: string = '#FFFFFF'; + + /** + * Linear gradient to color. + */ + static readonly LINEAR_GRADIENT_TO_COLOR: string = '#F1F3F5'; + + /** + * Linear gradient to area. + */ + static readonly LINEAR_GRADIENT_TO_AREA: number = 0.02; + + /** + * Follow item picture max height. + */ + static readonly FOLLOW_ITEM_PICTURE_MAX_HEIGHT: string = '60%'; + + /** + * Follow title space. + */ + static readonly FOLLOW_TITLE_SPACE: string = '24vp'; +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/model/FollowModel.ets b/MultiCommunityApplication/features/hot/src/main/ets/model/FollowModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef66c63e03bbaabb3923f4c7fccd741272ec033a --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/model/FollowModel.ets @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2023 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 interface FollowItemInterface { + name: ResourceStr; + icon: Resource; + date: ResourceStr; + picture: Resource; + type: ResourceStr; + subType: ResourceStr; + content: ResourceStr; + shareCount: number; + viewCount: number; + favourCount: number; +} + +export const FOLLOW_LIST: FollowItemInterface[] = [ + { + name: $r("app.string.follow_list_name_1"), + icon: $r('app.media.ic_follow_icon1'), + date: $r('app.string.follow_list_date_1'), + picture: $r('app.media.ic_follow_picture1'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 1557, + viewCount: 57, + favourCount: 1557 + }, + { + name: $r('app.string.follow_list_name_2'), + icon: $r('app.media.ic_follow_icon2'), + date: $r('app.string.follow_list_date_2'), + picture: $r('app.media.ic_follow_picture2'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 154, + viewCount: 34, + favourCount: 127 + }, + { + name: $r('app.string.follow_list_name_3'), + icon: $r('app.media.ic_follow_icon3'), + date: $r('app.string.follow_list_date_3'), + picture: $r('app.media.ic_follow_picture3'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 134, + viewCount: 35, + favourCount: 357 + }, + { + name: $r('app.string.follow_list_name_4'), + icon: $r('app.media.ic_follow_icon4'), + date: $r('app.string.follow_list_date_4'), + picture: $r('app.media.ic_follow_picture4'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 154, + viewCount: 54, + favourCount: 145 + }, + { + name: $r('app.string.follow_list_name_5'), + icon: $r('app.media.ic_follow_icon5'), + date: $r('app.string.follow_list_date_1'), + picture: $r('app.media.ic_follow_picture5'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 1257, + viewCount: 573, + favourCount: 1357 + }, + { + name: $r('app.string.follow_list_name_6'), + icon: $r('app.media.ic_follow_icon6'), + date: $r('app.string.follow_list_date_6'), + picture: $r('app.media.ic_follow_picture6'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 187, + viewCount: 56, + favourCount: 127 + }, + { + name: $r('app.string.follow_list_name_7'), + icon: $r('app.media.ic_follow_icon1'), + date: $r('app.string.follow_list_date_4'), + picture: $r('app.media.ic_follow_picture7'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 757, + viewCount: 17, + favourCount: 156 + }, + { + name: $r('app.string.follow_list_name_8'), + icon: $r('app.media.ic_follow_icon2'), + date: $r('app.string.follow_list_date_8'), + picture: $r('app.media.ic_follow_picture8'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 345, + viewCount: 56, + favourCount: 1366 + }, + { + name: $r('app.string.follow_list_name_9'), + icon: $r('app.media.ic_follow_icon3'), + date: $r('app.string.follow_list_date_1'), + picture: $r('app.media.ic_follow_picture9'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 1557, + viewCount: 57, + favourCount: 1557 + }, + { + name: $r('app.string.follow_list_name_1'), + icon: $r('app.media.ic_follow_icon1'), + date: $r('app.string.follow_list_date_1'), + picture: $r('app.media.ic_follow_picture1'), + type: $r('app.string.follow_list_type_1'), + subType: $r('app.string.follow_list_subtype_1'), + content: $r('app.string.follow_list_content_1'), + shareCount: 1557, + viewCount: 57, + favourCount: 1557 + } +]; + +export interface TitleDetailInterface { + name: ResourceStr; + icon?: Resource; + content?: ResourceStr; +} + +export const TITLE_DETAIL_LIST: TitleDetailInterface[] = [ + { + name: $r('app.string.follow_detail_name_1') + }, + { + name: $r('app.string.follow_list_name_1'), + icon: $r('app.media.ic_follow_icon1'), + content: $r('app.string.follow_detail_content_1') + }, + { + name: $r('app.string.follow_detail_name_2'), + icon: $r('app.media.ic_follow_icon2'), + content: $r('app.string.follow_detail_content_2') + }, + { + name: $r('app.string.follow_list_name_3'), + icon: $r('app.media.ic_follow_icon3'), + content: $r('app.string.follow_detail_content_3') + }, + { + name: $r('app.string.follow_detail_name_3'), + icon: $r('app.media.ic_follow_icon4'), + content: $r('app.string.follow_detail_content_4') + }, + { + name: $r('app.string.follow_detail_name_4'), + icon: $r('app.media.ic_follow_icon5'), + content: $r('app.string.follow_detail_content_5') + }, + { + name: $r('app.string.follow_list_name_6'), + icon: $r('app.media.ic_follow_icon6'), + content: $r('app.string.follow_detail_content_6') + }, + { + name: $r('app.string.follow_detail_name_5'), + icon: $r('app.media.ic_follow_icon1'), + content: $r('app.string.follow_detail_content_7') + }, + { + name: $r('app.string.follow_list_name_8'), + icon: $r('app.media.ic_follow_icon2'), + content: $r('app.string.follow_detail_content_8') + }, + { + name: $r('app.string.follow_detail_name_6'), + icon: $r('app.media.ic_follow_icon3'), + content: $r('app.string.follow_detail_content_1') + } +]; \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/CardItemView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/CardItemView.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e057d73f986af090c9a0ebae599b1e79a9bea59 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/CardItemView.ets @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App as app } from '@kit.ArkUI'; +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants' +import { FollowItemInterface, FOLLOW_LIST, TITLE_DETAIL_LIST } from '../model/FollowModel'; + +@Preview +@Component +export struct CardItemView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @State index: number = 0; + item: FollowItemInterface = FOLLOW_LIST[0]; + name: string = ''; + + aboutToAppear(): void { + app.setImageRawDataCacheSize(1024*1024*100); + app.setImageCacheCount(100); + } + + build() { + Column() { + Row() { + Row() { + Image(this.index === 0 ? this.item.icon : TITLE_DETAIL_LIST[this.index].icon) + .width($r('app.float.follow_item_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.follow_item_icon_br')) + .autoResize(true) + + Column() { + Text(this.index === 0 ? this.item.name : TITLE_DETAIL_LIST[this.index].name) + .fontSize($r('app.float.follow_item_title_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + + Text(this.item.date) + .fontSize($r('app.float.follow_item_date_fs')) + .fontColor($r('app.color.follow_item_date_fc')) + } + .alignItems(HorizontalAlign.Start) + .margin({ + left: $r('app.float.follow_item_title_ml') + }) + } + + Image($r('app.media.ic_point_more')) + .width($r('app.float.follow_item_more_width')) + .aspectRatio(1) + } + .width(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + + Stack() { + Image(this.item.picture) + .width(BaseCommon.FULL_PERCENT) + .objectFit(ImageFit.Cover) + .autoResize(true) + + Row() { + Text(this.item.type) + .fontSize($r('app.float.follow_item_type_fs')) + .fontColor(Color.White) + + Divider() + .vertical(true) + .width($r('app.float.follow_item_divider_width')) + .height($r('app.float.follow_item_divider_height')) + .margin({ + left: $r('app.float.follow_item_divider_ml'), + right: $r('app.float.follow_item_divider_ml') + }) + .color(Color.White) + + Text(this.item.subType) + .fontSize($r('app.float.follow_item_type_fs')) + .fontColor(Color.White) + } + .backgroundColor($r('app.color.follow_item_type_bgc')) + .padding({ + left: $r('app.float.follow_item_type_pl'), + right: $r('app.float.follow_item_type_pl'), + top: $r('app.float.follow_item_type_pt'), + bottom: $r('app.float.follow_item_type_pt') + }) + .borderRadius($r('app.float.follow_item_type_br')) + .margin({ + left: $r('app.float.follow_item_type_margin'), + bottom: $r('app.float.follow_item_type_margin') + }) + } + .alignContent(Alignment.BottomStart) + .margin({ + top: $r('app.float.follow_item_picture_margin'), + bottom: $r('app.float.follow_item_picture_margin') + }) + .constraintSize({ + maxHeight: Common.FOLLOW_ITEM_PICTURE_MAX_HEIGHT + }) + + Row() { + Text(this.item.content) + .maxLines(1) + .layoutWeight(1) + .textOverflow({ + overflow: TextOverflow.Ellipsis + }) + .fontColor($r('app.color.follow_item_content_fc')) + .fontSize($r('app.float.follow_item_content_fs')) + + Text($r('app.string.read_total')) + .fontColor($r('app.color.follow_item_content_total_fc')) + .fontSize($r('app.float.follow_item_content_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .margin({ + left: $r('app.float.follow_item_content_total_ml') + }) + } + .width(BaseCommon.FULL_PERCENT) + + Row() { + Row() { + Image($r('app.media.ic_toolbar_share')) + .height($r('app.float.follow_item_share_height')) + .aspectRatio(1) + + Text(`${this.item.shareCount}`) + .fontSize($r('app.float.follow_item_share_fs')) + .fontColor($r('app.color.follow_item_share_fc')) + .margin({ + left: $r('app.float.follow_item_share_ml') + }) + } + + Row() { + Image($r('app.media.ic_toolbar_comment')) + .height($r('app.float.follow_item_share_height')) + .aspectRatio(1) + + Text(`${this.item.viewCount}`) + .fontSize($r('app.float.follow_item_share_fs')) + .fontColor($r('app.color.follow_item_share_fc')) + .margin({ + left: $r('app.float.follow_item_share_ml') + }) + } + + Row() { + Image($r('app.media.ic_toolbar_heart')) + .height($r('app.float.follow_item_share_height')) + .aspectRatio(1) + + Text(`${this.item.favourCount}`) + .fontSize($r('app.float.follow_item_share_fs')) + .fontColor($r('app.color.follow_item_share_fc')) + .margin({ + left: $r('app.float.follow_item_share_ml') + }) + } + } + .width(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.follow_item_share_mt') + }) + } + .padding({ + top: $r('app.float.follow_item_margin_top'), + left: new BreakpointType($r('app.float.follow_item_sm_ml'), $r('app.float.follow_item_md_ml'), + $r('app.float.follow_item_lg_ml')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.follow_item_sm_ml'), $r('app.float.follow_item_md_ml'), + $r('app.float.follow_item_lg_ml')).getValue(this.currentBreakpoint), + bottom: $r('app.float.follow_item_margin_bottom') + }) + .borderRadius($r('app.float.follow_item_border_radius')) + .backgroundColor(Color.White) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/FollowView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/FollowView.ets new file mode 100644 index 0000000000000000000000000000000000000000..afd2caec7f125765ba7873cab7dee7dccb823e7c --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/FollowView.ets @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants' +import { CardItemView } from './CardItemView'; +import { TitleDetailInterface, TITLE_DETAIL_LIST } from '../model/FollowModel'; +import { FollowItemInterface, FOLLOW_LIST } from '../model/FollowModel'; + +@Component +export struct FollowView { + @StorageLink('currentBreakpoint') @Watch('updateShow') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('isShowHotTitle') @Watch('updateShow') isShowHotTitle: boolean = true; + @State @Watch('updateShow') indexSelected: number = 0; + @State @Watch('updateShow') indexTitleSelected: number = -1; + @State pageInfo: NavPathStack = new NavPathStack(); + iconList: TitleDetailInterface[] = TITLE_DETAIL_LIST; + iconTitleList: TitleDetailInterface[] = [] + listScroller: Scroller = new Scroller(); + listTitleScroller: Scroller = new Scroller(); + + updateShow() { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_SM && this.indexSelected !== 0) { + this.isShowHotTitle = false; + return; + } + + this.isShowHotTitle = true; + } + + aboutToAppear() { + TITLE_DETAIL_LIST.forEach((item: TitleDetailInterface, index: number) => { + if (index !== 0) { + this.iconTitleList.push(item); + } + }); + this.pageInfo.pushPath({ name: '' }); + } + + build() { + Column() { + Column() { + Row() { + Text($r('app.string.read_total')) + .fontSize($r('app.float.follow_total_font_size')) + .fontColor($r('app.color.follow_total_font_color')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + + Row() { + Text($r('app.string.more')) + .fontSize($r('app.float.follow_more_font_size')) + .fontColor($r('app.color.follow_more_font_color')) + + Image($r('app.media.ic_public_arrow_right_filled')) + .width($r('app.float.follow_more_icon_width')) + .aspectRatio(1) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(BaseCommon.FULL_PERCENT) + .padding({ + left: $r('app.float.follow_more_padding'), + right: $r('app.float.follow_more_padding') + }) + .visibility(this.isShowHotTitle ? Visibility.Visible : Visibility.None) + + List({ space: Common.FOLLOW_TITLE_SPACE, scroller: this.listTitleScroller }) { + ForEach(this.iconTitleList, (item: TitleDetailInterface, index: number) => { + ListItem() { + Column() { + Image(item.icon) + .width($r('app.float.follow_title_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.follow_title_icon_br')) + .borderWidth(index === this.indexTitleSelected ? $r('app.float.follow_title_icon_bw') : + $r('app.float.zero')) + .borderColor($r('app.color.follow_title_icon_bc')) + + Text(item.name) + .width($r('app.float.follow_title_text_width')) + .fontSize($r('app.float.follow_title_text_font_size')) + .fontColor(index === this.indexTitleSelected ? $r('app.color.follow_title_select') : + $r('app.color.follow_title_normal')) + .textAlign(TextAlign.Center) + .margin({ + top: $r('app.float.follow_title_text_mt') + }) + } + .margin({ + left: index === 0 ? $r('app.float.follow_title_margin_left') : $r('app.float.zero'), + right: index === this.iconTitleList.length - 1 ? $r('app.float.follow_title_margin_left') : + $r('app.float.zero') + }) + } + .onClick(() => { + this.indexTitleSelected = index; + this.indexSelected = index + 1; + this.listScroller.scrollToIndex(this.indexSelected); + this.pageInfo.clear(); + this.pageInfo.pushPath(new NavPathInfo(`${index}`, ''), false); + }) + }, (item: TitleDetailInterface, index: number) => index + JSON.stringify(item)) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .padding({ + top: $r('app.float.follow_title_list_padding_top') + }) + .height($r('app.float.follow_title_height')) + .width(BaseCommon.FULL_PERCENT) + .margin($r('app.float.zero')) + + if (this.indexTitleSelected !== -1) { + Row() { + Text() { + Span(this.iconTitleList[this.indexTitleSelected].name) + Span($r('app.string.follow_title_content')) + } + .fontSize($r('app.float.follow_title_content_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor($r('app.color.follow_title_content_fc')) + + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.follow_title_cancel')) + .aspectRatio(1) + .onClick(() => { + this.indexTitleSelected = -1; + this.indexSelected = 0; + this.listScroller.scrollToIndex(0); + + this.pageInfo.clear(); + this.pageInfo.pushPath(new NavPathInfo(`${this.indexSelected}`, ''), false); + }) + } + .width(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.follow_title_message_padding_left'), + right: $r('app.float.follow_title_message_padding_left') + }) + .margin({ + top: $r('app.float.follow_title_message_margin_top') + }) + } + } + .padding({ + top: $r('app.float.follow_title_padding_top') + }) + .width(BaseCommon.FULL_PERCENT) + .visibility(this.currentBreakpoint === Breakpoint.BREAKPOINT_SM ? Visibility.Visible : Visibility.None) + .backgroundColor(this.indexTitleSelected === -1 ? Color.White : $r('app.color.follow_title_bgc')) + + Navigation(this.pageInfo) { + List({ initialIndex: this.indexSelected, scroller: this.listScroller }) { + ForEach(this.iconList, (item: TitleDetailInterface, index: number) => { + ListItem() { + Row() { + if (item.icon !== undefined) { + Image(item.icon) + .width($r('app.float.follow_guide_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.follow_guide_icon_br')) + } else { + Row() + .width($r('app.float.follow_guide_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.follow_guide_icon_br')) + .backgroundColor($r('app.color.follow_guide_icon_color')) + } + + Column() { + Text(item.name) + .fontSize($r('app.float.follow_guide_name_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor($r('app.color.follow_guide_name_fc')) + + Text(item?.content) + .fontSize($r('app.float.follow_guide_content_fs')) + .fontColor($r('app.color.follow_guide_content_fc')) + } + .margin({ + left: $r('app.float.follow_guide_name_ml') + }) + .alignItems(HorizontalAlign.Start) + } + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.follow_guide_item_height')) + .backgroundColor(this.indexSelected === index ? $r('app.color.follow_guide_selected_bgc') : Color.White) + .padding({ + left: $r('app.float.follow_guide_item_pl') + }) + .onClick(() => { + this.indexSelected = index; + this.indexTitleSelected = index - 1; + this.listTitleScroller.scrollToIndex(this.indexTitleSelected < 0 ? 0 : this.indexTitleSelected); + this.pageInfo.clear(); + this.pageInfo.pushPath(new NavPathInfo(`${index}`, ''), false); + }) + } + }, (item: TitleDetailInterface, index: number) => index + JSON.stringify(item)) + } + .scrollBar(BarState.Off) + } + .hideTitleBar(true) + .hideBackButton(true) + .hideToolBar(true) + .mode(NavigationMode.Split) + .navBarWidth(new BreakpointType($r('app.float.zero'), $r('app.float.nav_bar_width_md'), + $r('app.float.nav_bar_width_lg')).getValue(this.currentBreakpoint)) + .hideNavBar(this.currentBreakpoint === Breakpoint.BREAKPOINT_SM) + .layoutWeight(1) + .navDestination(this.pageMap) + } + .justifyContent(FlexAlign.Start) + .backgroundColor($r('app.color.nav_content_bgd')) + .height(BaseCommon.FULL_PERCENT) + } + + @Builder + pageMap(name: string) { + NavDestination() { + WaterFlow() { + ForEach(FOLLOW_LIST, (item: FollowItemInterface) => { + FlowItem() { + CardItemView({ + item: item, + index: this.indexSelected + }) + } + }, (item: FollowItemInterface, index: number) => index + JSON.stringify(item)) + } + .backgroundColor($r('app.color.nav_content_bgd')) + .padding({ + top: new BreakpointType($r('app.float.follow_water_flow_padding_sm'), + $r('app.float.follow_water_flow_padding_md'), $r('app.float.follow_water_flow_padding_lg')) + .getValue(this.currentBreakpoint), + left: new BreakpointType($r('app.float.follow_water_flow_padding_sm'), + $r('app.float.follow_water_flow_padding_md'), $r('app.float.follow_water_flow_padding_lg')) + .getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.follow_water_flow_padding_sm'), + $r('app.float.follow_water_flow_padding_md'), $r('app.float.follow_water_flow_padding_lg')) + .getValue(this.currentBreakpoint), + bottom: new BreakpointType($r('app.float.follow_water_flow_padding_sm'), + $r('app.float.follow_water_flow_padding_md'), $r('app.float.follow_water_flow_padding_lg')) + .getValue(this.currentBreakpoint) + }) + .columnsGap($r('app.float.follow_water_flow_column_gap')) + .rowsGap(new BreakpointType($r('app.float.follow_water_flow_padding_sm'), + $r('app.float.follow_water_flow_padding_md'), $r('app.float.follow_water_flow_padding_lg')) + .getValue(this.currentBreakpoint)) + .columnsTemplate(new BreakpointType(Common.WATER_FLOW_COLUMNS_TEMPLATE_NORMAL, + Common.WATER_FLOW_COLUMNS_TEMPLATE_NORMAL, Common.WATER_FLOW_COLUMNS_TEMPLATE_LG) + .getValue(this.currentBreakpoint)) + } + .width(BaseCommon.FULL_PERCENT) + .height(BaseCommon.FULL_PERCENT) + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/FoundView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/FoundView.ets new file mode 100644 index 0000000000000000000000000000000000000000..b69991cc7c637d6e9bbd8e70167f85b5cfd608dd --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/FoundView.ets @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { CommentBarView, MircoBlogView } from 'detail'; +import { CardArrayViewModel, CardArray } from 'detail'; +import { CardItem } from 'detail'; +import { CommonConstants as Common } from '../constants/CommonConstants'; +import { HotColumnView } from '../view/HotColumnView'; + +@Component +export struct FoundView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('cardArrayViewModel') cardArrayViewModel: CardArray = CardArrayViewModel.getInstance(); + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @State tabIndexSelected: number = 0; + + jumpDetail() { + this.pageInfos.pushPath({name : 'detailPage'}); + } + + @Builder + TitleBarBuilder() { + Row() { + List({ + space: new BreakpointType(Common.WINDOW_PADDING_SM, Common.WINDOW_PADDING_MD, + Common.WINDOW_PADDING_LG).getValue(this.currentBreakpoint) + }) { + ForEach(BaseCommon.RANK_TITLE_LIST, (item: ResourceStr, index: number) => { + ListItem() { + Text(item) + .fontSize($r('app.float.rank_name_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor(this.tabIndexSelected === index ? $r('app.color.tab_selected') : $r('app.color.tab_normal')) + .height($r('app.float.rank_name_height')) + .onClick(() => { + this.tabIndexSelected = index; + }) + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.rank_title_height')) + .alignListItem(ListItemAlign.Center) + .scrollBar(BarState.Off) + } + .width(BaseCommon.FULL_PERCENT) + .justifyContent(this.currentBreakpoint !== Breakpoint.BREAKPOINT_SM ? FlexAlign.SpaceBetween : FlexAlign.Start) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + top: $r('app.float.tab_bar_padding_top') + }) + } + + build() { + Scroll() { + Column() { + this.TitleBarBuilder() + + Tabs({ index: this.tabIndexSelected, barPosition: BarPosition.Start }) { + ForEach(BaseCommon.RANK_TITLE_LIST, (item: ResourceStr) => { + TabContent() { + HotColumnView({ + tab_index: this.tabIndexSelected + }) + } + }, (item: string) => JSON.stringify(item)) + } + .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_mode_margin') }) + .barHeight($r('app.float.tab_bar_height')) + .animationDuration(Common.TAB_ANIMATION_DURATION) + .scrollable(false) + .barHeight($r('app.float.zero')) + .height($r('app.float.rank_list_height')) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint) + }) + + Blank() + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.blank_height')) + .visibility(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? Visibility.Hidden : Visibility.Visible) + + // [Start foundView] + WaterFlow() { + // [StartExclude foundView] + ForEach(this.cardArrayViewModel.cardArray, (item: CardItem, index: number) => { + FlowItem() { + Column() { + MircoBlogView({ + cardItem: item, + index: index, + jumpDetail: () => { + AppStorage.setOrCreate('selectCardIndex', index); + this.jumpDetail(); + } + }) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), + $r('app.float.window_padding_left_md'), $r('app.float.window_padding_left_sm')) + .getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), + $r('app.float.window_padding_left_md'), $r('app.float.window_padding_left_sm')) + .getValue(this.currentBreakpoint), + top: new BreakpointType($r('app.float.zero'), $r('app.float.zero'), + $r('app.float.card_margin_top_lg')).getValue(this.currentBreakpoint) + }) + + CommentBarView({ + isShowInput: false, + jumpDetail: () => { + AppStorage.setOrCreate('selectCardIndex', index); + this.jumpDetail(); + } + }) + } + .borderRadius(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? + $r('app.float.water_flow_br') : $r('app.float.zero')) + .backgroundColor($r('app.color.white')) + .margin(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? + $r('app.float.water_flow_margin') : $r('app.float.zero')) + } + }, (item: CardItem, index: number) => index + JSON.stringify(item)) + // [EndExclude foundView] + } + .columnsTemplate(this.currentBreakpoint !== Breakpoint.BREAKPOINT_LG ? + Common.WATER_FLOW_COLUMNS_TEMPLATE_NORMAL : Common.WATER_FLOW_COLUMNS_TEMPLATE_LG) + // [End foundView] + .backgroundColor(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? + $r('app.color.water_flow_bgc_lg') : $r('app.color.water_flow_bgc')) + .linearGradient({ + angle: Common.LINEAR_GRADIENT_ANGEL, + colors: [ + [Common.LINEAR_GRADIENT_FROM_COLOR, 0], + [Common.LINEAR_GRADIENT_TO_COLOR, Common.LINEAR_GRADIENT_TO_AREA] + ] + }) + .rowsGap(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? + $r('app.float.zero') : $r('app.float.water_flow_rows_gap')) + .nestedScroll({ + scrollForward: NestedScrollMode.PARENT_FIRST, + scrollBackward: NestedScrollMode.SELF_FIRST + }) + .padding({ + left: this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? $r('app.float.water_flow_padding_lg') : + $r('app.float.zero'), + right: this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? $r('app.float.water_flow_padding_lg') : + $r('app.float.zero'), + top: this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? $r('app.float.water_flow_padding_top_lg') : + $r('app.float.zero') + }) + } + } + .scrollBar(BarState.Off) + .layoutWeight(1) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/HotColumnView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/HotColumnView.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f616d6281329b3b86f41caa0542ad263083aa70 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/HotColumnView.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { HotItemInterface, HOST_LIST_ARRAY } from 'base'; +import { HotListItemView } from 'rank'; +import { CommonConstants as Common } from '../constants/CommonConstants'; +import { ToRankView } from './ToRankView'; + +const SWIPER_LIST: number[] = [0, 1, 2]; +// [Start hot_column_view] +@Component +export struct HotColumnView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + // [StartExclude hot_column_view] + @State tab_index: number = 0; + // [EndExclude hot_column_view] + @Builder + HotListBuilder(index: number) { + List() { + ForEach(HOST_LIST_ARRAY[this.tab_index], (item: HotItemInterface) => { + if (item.index > index * Common.HOT_COLUMN_MAX_COUNT && + item.index <= (index + 1) * Common.HOT_COLUMN_MAX_COUNT) { + ListItem() { + HotListItemView({ + item: item, + showDetail: true, + // [StartExclude hot_column_view] + indexWidth: item.index <= Common.HOT_COLUMN_MAX_COUNT ? $r('app.float.index_width_normal') : + $r('app.float.index_width_more'), + indexIconGap: $r('app.float.index_icon_gap') + // [EndExclude hot_column_view] + }) + } + } + }, (item: HotItemInterface) => JSON.stringify(item)) + } + } + + build() { + Column() { + Swiper() { + ForEach(SWIPER_LIST, (item: number) => { + this.HotListBuilder(item) + }, (item: number) => JSON.stringify(item)) + } + // [StartExclude hot_column_view] + .autoPlay(false) + .indicator(false) + .disableSwipe(true) + .displayCount(new BreakpointType( + Common.SWIPER_DISPLAY_COUNT_ONE, + Common.SWIPER_DISPLAY_COUNT_TWO, + Common.SWIPER_DISPLAY_COUNT_THREE + ).getValue(this.currentBreakpoint)) + .itemSpace((new BreakpointType(Common.HOT_COLUMN_IS_SM, Common.HOT_COLUMN_IS_MD, Common.HOT_COLUMN_IS_LG)) + .getValue(this.currentBreakpoint)) + + ToRankView() + // [EndExclude hot_column_view] + } + // [StartExclude hot_column_view] + .width(BaseCommon.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + // [EndExclude hot_column_view] + } +} +// [End hot_column_view] \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/HotPointPage.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/HotPointPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3196a477fc6f790c249f1f0efb58af10379b004 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/HotPointPage.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon } from 'base/'; +import { FoundView } from './FoundView'; +import { FollowView } from './FollowView'; +import { HotTitleView } from './HotTitleView'; + +@Component +export struct HotPointPage { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('isFoundSelected') isFoundSelected: boolean = true; + @StorageLink('isShowHotTitle') isShowHotTitle: boolean = true; + + build() { + Column() { + Column() { + if (this.isShowHotTitle) { + HotTitleView() + } + + if (this.isFoundSelected) { + FoundView() + } else { + Column() { + FollowView() + } + .layoutWeight(1) + } + } + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + } + .padding({ + top: deviceInfo.deviceType === BaseCommon.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') + }) + .backgroundColor($r('app.color.white')) + .height(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/HotTitleView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/HotTitleView.ets new file mode 100644 index 0000000000000000000000000000000000000000..54dce745a8f81881aa033d99fb43e43656c57719 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/HotTitleView.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { SearchBarView } from '../view/SearchBarView'; + +@Component +export struct HotTitleView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('isFoundSelected') isFoundSelected: boolean = false; + + build() { + Column() { + Stack() { + Row() { + Text($r('app.string.found')) + .fontSize(this.isFoundSelected ? $r('app.float.title_font_size_selected') : + $r('app.float.title_font_size_normal')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor(Color.Black) + .opacity(this.isFoundSelected ? $r('app.float.title_opacity_selected') : + $r('app.float.title_opacity_normal')) + .onClick(()=>{ + this.isFoundSelected = true; + }) + + Text($r('app.string.follow')) + .fontSize(this.isFoundSelected ? $r('app.float.title_font_size_normal') : + $r('app.float.title_font_size_selected')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor(Color.Black) + .margin({ + left: new BreakpointType($r('app.float.title_margin_left_sm'), $r('app.float.title_margin_left_md'), + $r('app.float.title_margin_left_lg')).getValue(this.currentBreakpoint) + }) + .opacity(this.isFoundSelected ? $r('app.float.title_opacity_normal') : + $r('app.float.title_opacity_selected')) + .onClick(()=>{ + this.isFoundSelected = false; + }) + } + .width(BaseCommon.FULL_PERCENT) + .height(BaseCommon.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + + SearchBarView() + .width(new BreakpointType($r('app.float.search_bar_view_width_sm'), $r('app.float.search_bar_view_width_md'), + $r('app.float.search_bar_view_width_lg')).getValue(this.currentBreakpoint)) + } + .alignContent(Alignment.End) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint) + }) + } + .height($r('app.float.hot_title_height')) + .borderColor($r('app.color.hot_title_border_color')) + .borderWidth({ + bottom: new BreakpointType($r('app.float.hot_title_border_width_normal'), + $r('app.float.hot_title_border_width_normal'), $r('app.float.hot_title_border_width_more') + ).getValue(this.currentBreakpoint) + }) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/SearchBarView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/SearchBarView.ets new file mode 100644 index 0000000000000000000000000000000000000000..5036809b6a909c9a5c91a12f9fc793a240f0dc82 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/SearchBarView.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +@Component +export struct SearchBarView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + + build() { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_SM) { + Row() { + Image($r('app.media.ic_public_input_search')) + .width($r('app.float.input_search_icon_width')) + .aspectRatio(1) + } + } else { + Row() { + Row() { + Image($r('app.media.ic_public_search')) + .height($r('app.float.icon_search_height')) + .aspectRatio(1) + .margin({ left: $r('app.float.icon_search_ml') }) + + TextInput({ placeholder: $r('app.string.placeholder') }) + .layoutWeight(1) + .backgroundColor($r('app.color.acetate')) + .padding({ left: $r('app.float.zero') }) + .margin({ left: $r('app.float.search_input_margin_left') }) + .enableKeyboardOnFocus(false) + + Image($r('app.media.ic_public_voice')) + .height($r('app.float.icon_voice_height')) + .aspectRatio(1) + .margin({ left: $r('app.float.icon_voice_ml') }) + + Image($r('app.media.ic_public_spinner_small')) + .width($r('app.float.spinner_small_width')) + .height($r('app.float.spinner_small_height')) + .margin({ right: $r('app.float.spinner_small_ml') }) + } + .backgroundColor($r('app.color.white')) + .borderRadius($r('app.float.search_bar_br')) + .borderWidth($r('app.float.search_bar_bw')) + .height($r('app.float.search_bar_height')) + .width(BaseCommon.FULL_PERCENT) + .margin({ + top: $r('app.float.search_bar_mt'), + bottom: $r('app.float.search_bar_mt') + }) + .opacity(Common.SEARCH_BAR_OPACITY) + } + .alignItems(VerticalAlign.Center) + } + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/ets/view/ToRankView.ets b/MultiCommunityApplication/features/hot/src/main/ets/view/ToRankView.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2be1f7cdcffc9134cbe4dd08d11c472344b2dac --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/ets/view/ToRankView.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants as Common } from '../constants/CommonConstants' + +@Component +export struct ToRankView { + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + + build() { + Row() { + Text($r('app.string.read_total_rank')) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.read_total_rank_color')) + .fontSize($r('app.float.read_total_rank_fs')) + + Image($r('app.media.ic_more')) + .width($r('app.float.arrow_right_width')) + .aspectRatio(1) + .margin({ left: $r('app.float.arrow_right_ml') }) + .opacity(Common.ICON_MORE_OPACITY) + } + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .margin({ top: $r('app.float.read_total_rank_mt') }) + .onClick(() => { + this.pageInfos.pushPath({ name: 'rankPage' }); + }) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/module.json5 b/MultiCommunityApplication/features/hot/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2b99b58f6d584627a4225282e094914115a387ab --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "hot", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/element/color.json b/MultiCommunityApplication/features/hot/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..2fc432124d09aafdb3cd622c35fc716e7a9a91bf --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/element/color.json @@ -0,0 +1,108 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "pink", + "value": "#1fff9a6e" + }, + { + "name": "tab_selected", + "value": "#000000" + }, + { + "name": "tab_normal", + "value": "#99000000" + }, + { + "name": "hot_title_border_color", + "value": "#0d000000" + }, + { + "name": "water_flow_bgc", + "value": "#0d000000" + }, + { + "name": "acetate", + "value": "#00000000" + }, + { + "name": "read_total_rank_color", + "value": "#66000000" + }, + { + "name": "water_flow_bgc_lg", + "value": "#F1F3F5" + }, + { + "name": "follow_item_date_fc", + "value": "#66000000" + }, + { + "name": "follow_item_type_bgc", + "value": "#66000000" + }, + { + "name": "follow_item_content_fc", + "value": "#A6000000" + }, + { + "name": "follow_item_content_total_fc", + "value": "#0A59F7" + }, + { + "name": "follow_item_share_fc", + "value": "#D9000000" + }, + { + "name": "follow_total_font_color", + "value": "#E6000000" + }, + { + "name": "follow_more_font_color", + "value": "#66000000" + }, + { + "name": "follow_title_icon_bc", + "value": "#0A59F7" + }, + { + "name": "follow_title_select", + "value": "#0A59F7" + }, + { + "name": "follow_title_normal", + "value": "#99000000" + }, + { + "name": "follow_title_content_fc", + "value": "#E6000000" + }, + { + "name": "follow_title_bgc", + "value": "#F1F3F5" + }, + { + "name": "follow_guide_icon_color", + "value": "#94B5F6" + }, + { + "name": "follow_guide_name_fc", + "value": "#E6000000" + }, + { + "name": "follow_guide_content_fc", + "value": "#66000000" + }, + { + "name": "follow_guide_selected_bgc", + "value": "#F1F3F5" + }, + { + "name": "nav_content_bgd", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/element/float.json b/MultiCommunityApplication/features/hot/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..3e340036699b690f6dd13bce987db6ec85732306 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/element/float.json @@ -0,0 +1,472 @@ +{ + "float": [ + { + "name": "search_bar_view_ml", + "value": "16vp" + }, + { + "name": "rank_name_fs", + "value": "18fp" + }, + { + "name": "rank_name_height", + "value": "22vp" + }, + { + "name": "rank_title_height", + "value": "40vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_bar_margin_left", + "value": "32vp" + }, + { + "name": "tab_bar_mode_margin", + "value": "6vp" + }, + { + "name": "tab_bar_height", + "value": "28vp" + }, + { + "name": "rank_list_height", + "value": "384vp" + }, + { + "name": "water_flow_br", + "value": "8vp" + }, + { + "name": "water_flow_margin", + "value": "6vp" + }, + { + "name": "water_flow_rows_gap", + "value": "8vp" + }, + { + "name": "water_flow_margin_left", + "value": "26vp" + }, + { + "name": "hot_column_padding_left", + "value": "16vp" + }, + { + "name": "icon_search_height", + "value": "16vp" + }, + { + "name": "icon_search_ml", + "value": "12vp" + }, + { + "name": "search_input_margin_left", + "value": "8vp" + }, + { + "name": "icon_voice_height", + "value": "16vp" + }, + { + "name": "icon_voice_ml", + "value": "12vp" + }, + { + "name": "spinner_small_width", + "value": "8vp" + }, + { + "name": "spinner_small_height", + "value": "16vp" + }, + { + "name": "spinner_small_ml", + "value": "9vp" + }, + { + "name": "search_bar_br", + "value": "20vp" + }, + { + "name": "search_bar_bw", + "value": "1.5vp" + }, + { + "name": "search_bar_height", + "value": "40vp" + }, + { + "name": "search_bar_mt", + "value": "8vp" + }, + { + "name": "search_height", + "value": "56vp" + }, + { + "name": "read_total_rank_fs", + "value": "12fp" + }, + { + "name": "arrow_right_width", + "value": "16vp" + }, + { + "name": "arrow_right_ml", + "value": "1vp" + }, + { + "name": "read_total_rank_mt", + "value": "4vp" + }, + { + "name": "search_bar_margin_top", + "value": "24vp" + }, + { + "name": "window_padding_left_sm", + "value": "16vp" + }, + { + "name": "window_padding_left_md", + "value": "24vp" + }, + { + "name": "window_padding_left_lg", + "value": "32vp" + }, + { + "name": "card_padding_lg", + "value": "8vp" + }, + { + "name": "water_flow_padding_lg", + "value": "26vp" + }, + { + "name": "water_flow_padding_top_lg", + "value": "16vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + }, + { + "name": "index_width_normal", + "value": "9vp" + }, + { + "name": "index_width_more", + "value": "19vp" + }, + { + "name": "index_icon_gap", + "value": "8vp" + }, + { + "name": "card_margin_top_lg", + "value": "8vp" + }, + { + "name": "blank_height", + "value": "16vp" + }, + { + "name": "title_font_size_normal", + "value": "18fp" + }, + { + "name": "title_font_size_selected", + "value": "24fp" + }, + { + "name": "title_opacity_normal", + "value": "0.6" + }, + { + "name": "title_opacity_selected", + "value": "0.97" + }, + { + "name": "title_margin_left_sm", + "value": "40vp" + }, + { + "name": "title_margin_left_md", + "value": "48vp" + }, + { + "name": "title_margin_left_lg", + "value": "56vp" + }, + { + "name": "search_bar_view_width_sm", + "value": "24vp" + }, + { + "name": "search_bar_view_width_md", + "value": "184vp" + }, + { + "name": "search_bar_view_width_lg", + "value": "232vp" + }, + { + "name": "hot_title_height", + "value": "56vp" + }, + { + "name": "hot_title_border_width_normal", + "value": "1vp" + }, + { + "name": "hot_title_border_width_more", + "value": "2vp" + }, + { + "name": "tab_bar_padding_top", + "value": "4vp" + }, + { + "name": "follow_item_icon_width", + "value": "36vp" + }, + { + "name": "follow_item_icon_br", + "value": "18vp" + }, + { + "name": "follow_item_title_fs", + "value": "14fp" + }, + { + "name": "follow_item_date_fs", + "value": "12fp" + }, + { + "name": "follow_item_title_ml", + "value": "8vp" + }, + { + "name": "follow_item_more_width", + "value": "22vp" + }, + { + "name": "follow_item_type_fs", + "value": "12fp" + }, + { + "name": "follow_item_divider_width", + "value": "1vp" + }, + { + "name": "follow_item_divider_height", + "value": "6vp" + }, + { + "name": "follow_item_divider_ml", + "value": "4vp" + }, + { + "name": "follow_item_type_pl", + "value": "10vp" + }, + { + "name": "follow_item_type_pt", + "value": "4vp" + }, + { + "name": "follow_item_type_br", + "value": "14vp" + }, + { + "name": "follow_item_type_margin", + "value": "12vp" + }, + { + "name": "follow_item_picture_margin", + "value": "8vp" + }, + { + "name": "follow_item_content_fs", + "value": "14fp" + }, + { + "name": "follow_item_content_total_ml", + "value": "1vp" + }, + { + "name": "follow_item_share_height", + "value": "24vp" + }, + { + "name": "follow_item_share_fs", + "value": "14fp" + }, + { + "name": "follow_item_share_ml", + "value": "9vp" + }, + { + "name": "follow_item_share_mt", + "value": "14vp" + }, + { + "name": "follow_item_border_radius", + "value": "15vp" + }, + { + "name": "follow_item_margin_top", + "value": "12vp" + }, + { + "name": "follow_item_margin_bottom", + "value": "16vp" + }, + { + "name": "follow_item_sm_ml", + "value": "12vp" + }, + { + "name": "follow_item_md_ml", + "value": "12vp" + }, + { + "name": "follow_item_lg_ml", + "value": "16vp" + }, + { + "name": "follow_total_font_size", + "value": "14fp" + }, + { + "name": "follow_more_font_size", + "value": "12fp" + }, + { + "name": "follow_more_icon_width", + "value": "12vp" + }, + { + "name": "follow_more_padding", + "value": "16vp" + }, + { + "name": "follow_title_icon_width", + "value": "40vp" + }, + { + "name": "follow_title_icon_br", + "value": "20vp" + }, + { + "name": "follow_title_icon_bw", + "value": "2vp" + }, + { + "name": "follow_title_text_width", + "value": "40vp" + }, + { + "name": "follow_title_text_font_size", + "value": "10fp" + }, + { + "name": "follow_title_text_mt", + "value": "4vp" + }, + { + "name": "follow_title_margin_left", + "value": "16vp" + }, + { + "name": "follow_title_list_padding_top", + "value": "8vp" + }, + { + "name": "follow_title_height", + "value": "80vp" + }, + { + "name": "follow_title_content_fs", + "value": "16fp" + }, + { + "name": "follow_title_cancel", + "value": "16vp" + }, + { + "name": "follow_title_message_padding_left", + "value": "16vp" + }, + { + "name": "follow_title_message_margin_top", + "value": "16vp" + }, + { + "name": "follow_title_padding_top", + "value": "8vp" + }, + { + "name": "follow_guide_icon_width", + "value": "48vp" + }, + { + "name": "follow_guide_icon_br", + "value": "24vp" + }, + { + "name": "follow_guide_name_fs", + "value": "16fp" + }, + { + "name": "follow_guide_content_fs", + "value": "14fp" + }, + { + "name": "follow_guide_name_ml", + "value": "12vp" + }, + { + "name": "follow_guide_item_height", + "value": "72vp" + }, + { + "name": "follow_guide_item_pl", + "value": "24vp" + }, + { + "name": "nav_bar_width_md", + "value": "200vp" + }, + { + "name": "nav_bar_width_lg", + "value": "224vp" + }, + { + "name": "follow_water_flow_padding_sm", + "value": "12vp" + }, + { + "name": "follow_water_flow_padding_md", + "value": "12vp" + }, + { + "name": "follow_water_flow_padding_lg", + "value": "12vp" + }, + { + "name": "follow_water_flow_column_gap", + "value": "16vp" + }, + { + "name": "input_search_icon_width", + "value": "24vp" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/element/string.json b/MultiCommunityApplication/features/hot/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb2580a874b20e96b9692f9b097a76b5ae2cd55 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/element/string.json @@ -0,0 +1,164 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "placeholder", + "value": "搜索或输入网址" + }, + { + "name": "read_total_rank", + "value": "查看完整榜单" + }, + { + "name": "follow", + "value": "关注" + }, + { + "name": "found", + "value": "发现" + }, + { + "name": "read_total", + "value": "查看全部" + }, + { + "name": "more", + "value": "更多" + }, + { + "name": "follow_list_name_1", + "value": "摄影视觉" + }, + { + "name": "follow_list_date_1", + "value": "2小时前·发布了动态" + }, + { + "name": "follow_list_type_1", + "value": "登山" + }, + { + "name": "follow_list_subtype_1", + "value": "旅游" + }, + { + "name": "follow_list_content_1", + "value": "在山顶,你会觉得山再巍峨,人也能把它征服,而此时的…" + }, + { + "name": "follow_list_name_2", + "value": "大自然的风采" + }, + { + "name": "follow_list_date_2", + "value": "11小时前·发布了动态" + }, + { + "name": "follow_list_name_3", + "value": "山水" + }, + { + "name": "follow_list_date_3", + "value": "3小时前·发布了动态" + }, + { + "name": "follow_list_name_4", + "value": "最科技评测" + }, + { + "name": "follow_list_date_4", + "value": "刚刚" + }, + { + "name": "follow_list_name_5", + "value": "故宫画家" + }, + { + "name": "follow_list_name_6", + "value": "国学展览" + }, + { + "name": "follow_list_date_6", + "value": "8小时前·发布了动态" + }, + { + "name": "follow_list_name_7", + "value": "自然社区" + }, + { + "name": "follow_list_name_8", + "value": "摄影视效" + }, + { + "name": "follow_list_date_8", + "value": "13小时前·发布了动态" + }, + { + "name": "follow_list_name_9", + "value": "国学探究" + }, + { + "name": "follow_detail_name_1", + "value": "全部关注" + }, + { + "name": "follow_detail_name_2", + "value": "大自然的风采" + }, + { + "name": "follow_detail_name_3", + "value": "科技评测" + }, + { + "name": "follow_detail_name_4", + "value": "风景画家" + }, + { + "name": "follow_detail_name_5", + "value": "自然社区" + }, + { + "name": "follow_detail_name_6", + "value": "自然社区" + }, + { + "name": "follow_detail_content_1", + "value": "摄影/10粉丝" + }, + { + "name": "follow_detail_content_2", + "value": "摄影/5万粉丝" + }, + { + "name": "follow_detail_content_3", + "value": "20万粉丝" + }, + { + "name": "follow_detail_content_4", + "value": "快速评测" + }, + { + "name": "follow_detail_content_5", + "value": "爱山爱水" + }, + { + "name": "follow_detail_content_6", + "value": "国学认证" + }, + { + "name": "follow_detail_content_7", + "value": "3万粉丝" + }, + { + "name": "follow_detail_content_8", + "value": "2小时前发布了..." + }, + { + "name": "follow_title_content", + "value": "的动态" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon1.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon1.png new file mode 100644 index 0000000000000000000000000000000000000000..006b2fa91c334557ad4a90aa65afb1fcaa127306 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon1.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon2.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon2.png new file mode 100644 index 0000000000000000000000000000000000000000..d4efeec7ddba67910883e49a950c1a846427beac Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon2.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon3.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon3.png new file mode 100644 index 0000000000000000000000000000000000000000..63599462403ba1f3fb9ce9033e6680a028f33507 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon3.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon4.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon4.png new file mode 100644 index 0000000000000000000000000000000000000000..5321e3c6beead31281bd91650a920d8a6c89e04c Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon4.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon5.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon5.png new file mode 100644 index 0000000000000000000000000000000000000000..fcf191932c50953adf7f5e5dd71557eff629e9a7 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon5.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon6.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon6.png new file mode 100644 index 0000000000000000000000000000000000000000..63599462403ba1f3fb9ce9033e6680a028f33507 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_icon6.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture1.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..74411d1bac3185911fe47b1c2b1acb9303954ca4 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture1.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture2.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture2.png new file mode 100644 index 0000000000000000000000000000000000000000..c64698d492e15313489dad66010e92fb8a75d60c Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture2.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture3.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3fb7f979741586252fbe1a45e92a938ecc308b43 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture3.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture4.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1719f1ea2684666404a98728af9b13d5498227ef Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture4.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture5.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ca6a84d44c94b528634da7fd1de6f3fb12306688 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture5.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture6.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..93b3910bd6a7a550236334c9b0070869fe9bc9d8 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture6.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture7.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c16f3b4fa683f030614820a470ddc5aff2a2078e Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture7.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture8.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b3455711215adc0725076b1affa17876fe5cec95 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture8.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture9.jpg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4e19fc1a1ef1d9d2a5d06334327447de81dcd15f Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_follow_picture9.jpg differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_more.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..a97f0741d12d38898004449222e9bb8ff6027007 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_more.svg @@ -0,0 +1,15 @@ + + + tuiJIanreSou/more + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_mountain.PNG b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_mountain.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c83d778426430a0fcaf0f2fb8906f50e7dd69979 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_mountain.PNG differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_point_more.png b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_point_more.png new file mode 100644 index 0000000000000000000000000000000000000000..0e8bfa04f42150689a320327cfc1232a926921a4 Binary files /dev/null and b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_point_more.png differ diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_arrow_right_filled.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_arrow_right_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..3b0e8d0a30145b2b62a9b5e00cb03dd48561be8f --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_arrow_right_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_arrow_right_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_cancel.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..36565c84256be091beb9bd8d8494c5e073defc3f --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_cancel.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cancel + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_input_search.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_input_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..dd6bfc7a1a21d1e10e7b4b7b28bb3795531ea717 --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_input_search.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_input_search + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_search.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..b6bbd0ae6ccf41763b59a952ca744d1f86009cef --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_search.svg @@ -0,0 +1,25 @@ + + + ic_s/ic S_search 2 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_spinner_small.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_spinner_small.svg new file mode 100644 index 0000000000000000000000000000000000000000..be7bb496fee083abbc4a8a3e9305f94891b6738d --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_spinner_small.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_spinner_small + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_voice.svg b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_voice.svg new file mode 100644 index 0000000000000000000000000000000000000000..418dded8bd9a67419f3f07bafef42f539bdd51fd --- /dev/null +++ b/MultiCommunityApplication/features/hot/src/main/resources/base/media/ic_public_voice.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_voice + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/Index.ets b/MultiCommunityApplication/features/picture/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..22841c49eccbd332c7aaa7fa82a796ad92747c25 --- /dev/null +++ b/MultiCommunityApplication/features/picture/Index.ets @@ -0,0 +1 @@ +export { PictureDetail } from './src/main/ets/view/PictureDetail'; \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/build-profile.json5 b/MultiCommunityApplication/features/picture/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiCommunityApplication/features/picture/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/hvigorfile.ts b/MultiCommunityApplication/features/picture/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiCommunityApplication/features/picture/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/features/picture/obfuscation-rules.txt b/MultiCommunityApplication/features/picture/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/features/picture/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/oh-package.json5 b/MultiCommunityApplication/features/picture/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9ef2eecc9260dbd57405aede998a7a73d98e8a64 --- /dev/null +++ b/MultiCommunityApplication/features/picture/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "picture", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "base": "file:../../commons/base", + "detail": "file:../detail" + } +} diff --git a/MultiCommunityApplication/features/picture/src/main/ets/view/DetailVerticalView.ets b/MultiCommunityApplication/features/picture/src/main/ets/view/DetailVerticalView.ets new file mode 100644 index 0000000000000000000000000000000000000000..82277051c21fae62ad1f46ba27ad3df217321cc4 --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/ets/view/DetailVerticalView.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { CommonConstants as BaseCommon, BreakpointConstants as Breakpoint } from 'base' +import { MircoBlogView, CommentListView, CommentBarView, CardArrayViewModel, CardArray } from 'detail'; + +@Component +export struct DetailVertical { + @StorageLink('cardArrayViewModel') cardArrayViewModel: CardArray = CardArrayViewModel.getInstance(); + @StorageProp('selectCardIndex') selectCardIndex: number = 0; + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + + build() { + Column() { + Scroll() { + Column() { + MircoBlogView({ + cardItem: this.cardArrayViewModel.cardArray[this.selectCardIndex], + index: this.selectCardIndex, + showPicture: false, + isDarkMode: true + }) + .padding({ + left: $r('app.float.picture_content_padding'), + right: $r('app.float.picture_content_padding') + }) + .margin({ + top: $r('app.float.detail_padding_top_md') + }) + + CommentListView({ + focusHide: true, + commentPadding: $r('app.float.picture_content_padding'), + isDarkMode: true + }) + .margin({ + top: $r('app.float.picture_comment_list_mt') + }) + } + } + .scrollBar(BarState.Off) + .layoutWeight(1) + + CommentBarView({ + isDarkMode: true + }) + } + .height(BaseCommon.FULL_PERCENT) + .padding({ + top: this.getPaddingTop() + }) + .backgroundColor($r('app.color.picture_background_color')) + } + + getPaddingTop(): Resource { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_LG && deviceInfo.deviceType !== BaseCommon.DEVICE_2IN1) { + return $r('app.float.detail_padding_top_md'); + } + return $r('app.float.zero'); + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/ets/view/PictureDetail.ets b/MultiCommunityApplication/features/picture/src/main/ets/view/PictureDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c4a14e057400eb0c0007f8c9ca0265cb1585346 --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/ets/view/PictureDetail.ets @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base/'; +import { CardArrayViewModel, CardArray, CommentInputView } from 'detail/'; +import { DetailVertical } from './DetailVerticalView'; + +const KEY_BACKGROUND: string = 'background'; + +@Component +export struct PictureDetail { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('cardArrayViewModel') cardArrayViewModel: CardArray = CardArrayViewModel.getInstance(); + @StorageLink('selectCardIndex') selectCardIndex: number = 0; + @StorageLink('isDetailPage') isDetailPage: boolean = false; + @StorageLink('isShowInput') isShowInput: boolean = false; + @StorageLink('isPictureDetail') isPictureDetail: boolean = true; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @State picList: Resource[] = []; + index: number = 0; + + aboutToAppear() { + this.isPictureDetail = true; + CardArrayViewModel.cardArray[this.selectCardIndex].pictureArray.forEach((item: Resource) => { + this.picList.push(item); + }) + } + + aboutToDisappear(): void { + this.isPictureDetail = false; + } + + build() { + Stack() { + Row() { + GridRow({ + columns: { + sm: Breakpoint.GRID_ROW_COLUMNS[2], + md: Breakpoint.GRID_ROW_COLUMNS[3], + lg: Breakpoint.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ + span: { + sm: Breakpoint.GRID_COLUMN_SPANS[5], + md: Breakpoint.GRID_COLUMN_SPANS[4], + lg: Breakpoint.GRID_COLUMN_SPANS[0] + } + }) { + Stack() { + Swiper() { + ForEach(this.picList, (item: Resource, index: number) => { + Stack() { + Image(item) + .width(BaseCommon.FULL_PERCENT) + .height(BaseCommon.FULL_PERCENT) + .objectFit(ImageFit.Contain) + + if (this.isDetailPage && index === this.picList.length - 1) { + Row() { + Button($r('app.string.above')) + .width($r('app.float.above_button_width')) + .height($r('app.float.button_height')) + .visibility(this.selectCardIndex === 0 ? Visibility.Hidden : Visibility.Visible) + .onClick(() => { + AppStorage.setOrCreate('selectCardIndex', this.selectCardIndex - 1); + this.pageInfos.replacePath({ name: 'pictureDetail', param: 0 }); + }) + + Button($r('app.string.next')) + .width($r('app.float.above_button_width')) + .height($r('app.float.button_height')) + .visibility(this.selectCardIndex === CardArrayViewModel.cardArray.length - 1 ? + Visibility.Hidden : Visibility.Visible) + .onClick(() => { + AppStorage.setOrCreate('selectCardIndex', this.selectCardIndex + 1); + this.pageInfos.replacePath({ name: 'pictureDetail', param: 0 }); + }) + } + .width(BaseCommon.FULL_PERCENT) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), + $r('app.float.window_padding_left_md'), $r('app.float.window_padding_left_lg')) + .getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), + $r('app.float.window_padding_left_md'), $r('app.float.window_padding_left_lg')) + .getValue(this.currentBreakpoint) + }) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ bottom: $r('app.float.button_line_margin_bottom') }) + } + } + .alignContent(Alignment.BottomStart) + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .autoPlay(false) + .indicator( + new DigitIndicator() + .fontColor($r('app.color.white')) + .digitFont({ + size: $r('app.float.swiper_digit_font_size'), + weight: FontWeight.Normal + }) + .selectedFontColor($r('app.color.white')) + .bottom($r('app.float.swiper_digit_bottom')) + ) + .loop(false) + .index(this.index) + .onClick(() => { + if (this.isDetailPage) { + this.pageInfos.pop(); + this.pageInfos.replacePath({ name: 'detailPage' }); + } else { + this.pageInfos.pop(); + } + }) + + Image($r('app.media.ic_public_back_white')) + .width($r('app.float.back_width')) + .aspectRatio(1) + .onClick(() => { + if (this.isDetailPage) { + this.pageInfos.pop(); + this.pageInfos.replacePath({ name: 'detailPage' }); + } else { + this.pageInfos.pop(); + } + }) + .margin({ + left: new BreakpointType($r('app.float.back_margin_left_sm'), + $r('app.float.back_margin_left_md'), $r('app.float.back_margin_left_lg')) + .getValue(this.currentBreakpoint), + top: $r('app.float.back_margin_top') + }) + } + .align(Alignment.TopStart) + } + + GridCol({ + span: { + sm: Breakpoint.GRID_COLUMN_SPANS[5], + md: Breakpoint.GRID_COLUMN_SPANS[6], + lg: Breakpoint.GRID_COLUMN_SPANS[0] + } + }) { + DetailVertical() + } + .visibility(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? Visibility.None : Visibility.Visible) + } + .layoutWeight(1) + + DetailVertical() + .width($r('app.float.content_with')) + .visibility(this.currentBreakpoint !== Breakpoint.BREAKPOINT_LG ? Visibility.None : Visibility.Visible) + } + .expandSafeArea([SafeAreaType.KEYBOARD, SafeAreaType.SYSTEM]) + + if (this.isShowInput) { + Stack() { + Column() + .justifyContent(FlexAlign.End) + .width(BaseCommon.FULL_PERCENT) + .height(BaseCommon.FULL_PERCENT) + .backgroundColor(Color.Black) + .opacity($r('app.float.text_input_bgc_opacity')) + .id(KEY_BACKGROUND) + .onClick(() => { + AppStorage.setOrCreate('isShowInput', false); + focusControl.requestFocus(KEY_BACKGROUND); + }) + + CommentInputView() + } + .alignContent(Alignment.Bottom) + } + } + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + .backgroundColor(Color.Black) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/module.json5 b/MultiCommunityApplication/features/picture/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6ad428a6f5f5d82f2948cf2d1264dd156a695fde --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "picture", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/resources/base/element/color.json b/MultiCommunityApplication/features/picture/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..de1446352e1091943f9ac8d893c89a6a9e980cac --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "picture_background_color", + "value": "#D9202224" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/resources/base/element/float.json b/MultiCommunityApplication/features/picture/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..d704278ea1c72c94abc2d6b32ecf01e448e2ba39 --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/resources/base/element/float.json @@ -0,0 +1,84 @@ +{ + "float": [ + { + "name": "content_with", + "value": "480vp" + }, + { + "name": "back_margin_top", + "value": "46vp" + }, + { + "name": "back_margin_left_sm", + "value": "18vp" + }, + { + "name": "back_margin_left_md", + "value": "26vp" + }, + { + "name": "back_margin_left_lg", + "value": "34vp" + }, + { + "name": "swiper_digit_font_size", + "value": "14fp" + }, + { + "name": "swiper_digit_bottom", + "value": "44vp" + }, + { + "name": "back_width", + "value": "24vp" + }, + { + "name": "above_button_width", + "value": "72vp" + }, + { + "name": "button_line_padding_left", + "value": "32vp" + }, + { + "name": "button_line_margin_bottom", + "value": "44vp" + }, + { + "name": "detail_padding_top_md", + "value": "24vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "button_height", + "value": "28vp" + }, + { + "name": "window_padding_left_sm", + "value": "16vp" + }, + { + "name": "window_padding_left_md", + "value": "24vp" + }, + { + "name": "window_padding_left_lg", + "value": "32vp" + }, + { + "name": "picture_content_padding", + "value": "16vp" + }, + { + "name": "text_input_bgc_opacity", + "value": "0.4" + }, + { + "name": "picture_comment_list_mt", + "value": "16vp" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/resources/base/element/string.json b/MultiCommunityApplication/features/picture/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6be1cdf92f2fb5bb1b38538b43e1944ccf787feb --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "above", + "value": "上一篇" + }, + { + "name": "next", + "value": "下一篇" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/picture/src/main/resources/base/media/ic_public_back_white.svg b/MultiCommunityApplication/features/picture/src/main/resources/base/media/ic_public_back_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..41a22008b33bbd44d6d8b2d45ae16fc576ddaeee --- /dev/null +++ b/MultiCommunityApplication/features/picture/src/main/resources/base/media/ic_public_back_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_back + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/Index.ets b/MultiCommunityApplication/features/rank/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ed50651eb0029513bded2c946c42e27b5c8a950 --- /dev/null +++ b/MultiCommunityApplication/features/rank/Index.ets @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2023 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 { HotListItemView } from './src/main/ets/view/HotListItemView'; +export { HotRankPage } from './src/main/ets/view/HotRankPage'; \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/build-profile.json5 b/MultiCommunityApplication/features/rank/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiCommunityApplication/features/rank/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/hvigorfile.ts b/MultiCommunityApplication/features/rank/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiCommunityApplication/features/rank/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/features/rank/obfuscation-rules.txt b/MultiCommunityApplication/features/rank/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/features/rank/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/oh-package.json5 b/MultiCommunityApplication/features/rank/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2e8e982446596886849e3f2aba1e8e2fb3a54b5d --- /dev/null +++ b/MultiCommunityApplication/features/rank/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "rank", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "base": "file:../../commons/base" + } +} diff --git a/MultiCommunityApplication/features/rank/src/main/ets/constants/CommonConstants.ets b/MultiCommunityApplication/features/rank/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..4304fcd1fde685edafe092d66225e35783fd8609 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 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 class CommonConstants { + /** + * Linear gradient angle. + */ + static readonly LINEAR_GRADIENT_ANGLE: number = 180; + + /** + * Linear gradient from. + */ + static readonly LINEAR_GRADIENT_FROM: number = 0.01; + + /** + * Linear gradient to. + */ + static readonly LINEAR_GRADIENT_TO: number = 0.92; + + /** + * Linear gradient from color. + */ + static readonly LINEAR_GRADIENT_FROM_COLOR: string = '#80307AF8'; + + /** + * Linear gradient to color. + */ + static readonly LINEAR_GRADIENT_TO_COLOR: string = '#000A59F7'; + + /** + * Subtitle opacity. + */ + static readonly SUBTITLE_OPACITY: number = 0.6; + + /** + * Swiper item space. + */ + static readonly SWIPER_ITEM_SPACE: string = '20vp'; + + /** + * Title content space. + */ + static readonly TITLE_CONTENT_SPACE: string = '4vp'; + + /** + * Top count. + */ + static readonly TOP_COUNT: number = 3; + + /** + * Window padding half sm. + */ + static readonly WINDOW_PADDING_HALF_SM = '8vp'; +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/ets/view/HotListItemView.ets b/MultiCommunityApplication/features/rank/src/main/ets/view/HotListItemView.ets new file mode 100644 index 0000000000000000000000000000000000000000..33ca2dd30455d96d64da5380a4f660de85a169f0 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/ets/view/HotListItemView.ets @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HotItemInterface, HOST_LIST_ARRAY, CommonConstants as BaseCommon } from 'base'; +import { CommonConstants as Common } from '../constants/CommonConstants'; + +@Component +export struct HotListItemView { + item: HotItemInterface = HOST_LIST_ARRAY[0][0]; + showDetail: boolean = false; + indexWidth: ResourceStr = $r('app.float.index_width_normal'); + indexIconGap: ResourceStr = $r('app.float.index_icon_gap_normal'); + + build() { + Row() { + Row() { + Text(`${this.item.index}`) + .fontSize($r('app.float.index_font_size')) + .fontWeight(BaseCommon.FONT_WEIGHT_500) + .fontColor(this.isTopThree() ? $r('app.color.top_three_color') : $r('app.color.normal_index_color')) + .textAlign(TextAlign.End) + .width(this.indexWidth) + + Row() { + if (this.isShowDetail()) { + Image(this.item.icon) + .width($r('app.float.list_item_icon_width')) + .aspectRatio(1) + .borderRadius($r('app.float.item_icon_br')) + } + + Column({ space: Common.TITLE_CONTENT_SPACE }) { + Row() { + Text(this.item.title) + .fontSize($r('app.float.rank_item_font_size')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + + Image(this.item.stateIcon) + .height($r('app.float.state_icon_height')) + .aspectRatio(1) + .margin({ left: $r('app.float.state_icon_margin_left') }) + } + .justifyContent(FlexAlign.Start) + + Text(this.item.content) + .fontSize($r('app.float.content_font_size')) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.content_color')) + .visibility(this.isShowDetail() ? Visibility.Visible : Visibility.None) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } + .alignItems(HorizontalAlign.Start) + .margin({ + left: this.isShowDetail() ? Common.WINDOW_PADDING_HALF_SM : $r('app.float.zero') + }) + .layoutWeight(1) + } + .layoutWeight(1) + .margin({ left: this.indexIconGap }) + .justifyContent(FlexAlign.Start) + + Row() { + Text(`${this.item.clickCount}`) + .fontSize($r('app.float.click_count_font_size')) + .fontWeight(FontWeight.Normal) + .textAlign(TextAlign.End) + .fontColor($r('app.color.click_count_color')) + + Image(this.item.upDownIcon) + .width($r('app.float.up_down_icon_width')) + .aspectRatio(1) + } + .height(BaseCommon.FULL_PERCENT) + .borderRadius($r('app.float.rank_list_rd')) + .margin({ + right: $r('app.float.icon_name_margin_left') + }) + } + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + } + .width(BaseCommon.FULL_PERCENT) + .height((this.isShowDetail()) ? $r('app.float.top_three_height') : $r('app.float.normal_item_height')) + } + + isShowDetail(): boolean { + return this.showDetail || this.isTopThree(); + } + + isTopThree(): boolean { + return this.item.index <= Common.TOP_COUNT; + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/ets/view/HotListView.ets b/MultiCommunityApplication/features/rank/src/main/ets/view/HotListView.ets new file mode 100644 index 0000000000000000000000000000000000000000..37ff8042150abfce97be6cc70963c5d33f8614a6 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/ets/view/HotListView.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HOST_LIST_ARRAY, CommonConstants as BaseCommon, HotItemInterface } from 'base'; +import { HotListItemView } from './HotListItemView'; + +@Component +export struct HotListView { + index: number = 0; + groupTitle: ResourceStr = ''; + + @Builder + itemHeader() { + Row() { + Text(this.groupTitle) + .fontSize($r('app.float.group_item_title_font_size')) + .fontWeight(BaseCommon.FONT_WEIGHT_700) + .fontColor($r('app.color.group_item_title_font_color')) + .margin({ left: $r('app.float.group_item_title_ml') }) + } + .height($r('app.float.group_item_title_height')) + .margin({ top: $r('app.float.group_item_title_mt') }) + .justifyContent(FlexAlign.Start) + } + + build() { + Row() { + List() { + ListItemGroup({ header: this.itemHeader() }) { + ForEach(HOST_LIST_ARRAY[this.index], (item: HotItemInterface) => { + ListItem() { + HotListItemView({ + item: item, + indexWidth: $r('app.float.index_width_more') + }) + } + }, (item: HotItemInterface) => JSON.stringify(item)) + } + } + .scrollBar(BarState.Off) + .nestedScroll({ + scrollForward: NestedScrollMode.PARENT_FIRST, + scrollBackward: NestedScrollMode.SELF_FIRST + }) + .edgeEffect(EdgeEffect.None) + .padding({ + left: $r('app.float.hot_list_pl') + }) + } + .borderRadius($r('app.float.rank_list_rd')) + .backgroundColor($r('app.color.white')) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/ets/view/HotRankPage.ets b/MultiCommunityApplication/features/rank/src/main/ets/view/HotRankPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae8f4f668b83eefffbbe8672ea5e34cbe3c283e1 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/ets/view/HotRankPage.ets @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as BaseCommon, BreakpointType } from 'base'; +import { HotListView } from './HotListView'; +import { CommonConstants as Common } from '../constants/CommonConstants' + +const MAX_MARGIN_TOP: number = 52; +const MIN_MARGIN_TOP: number = 46; + +@Component +export struct HotRankPage { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_SM; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @State titleMarginTop: number = MAX_MARGIN_TOP; + @State index: number = 0; + + build() { + Column() { + Stack() { + Row() + .linearGradient({ + angle: Common.LINEAR_GRADIENT_ANGLE, + colors: [ + [Common.LINEAR_GRADIENT_FROM_COLOR, Common.LINEAR_GRADIENT_FROM], + [Common.LINEAR_GRADIENT_TO_COLOR, Common.LINEAR_GRADIENT_TO] + ] + }) + .width(BaseCommon.FULL_PERCENT) + .height($r('app.float.background_height')) + + Column() { + Column() { + Text($r('app.string.rank_title')) + .fontSize(this.titleMarginTop === MIN_MARGIN_TOP ? + $r('app.float.title_normal_fs') : $r('app.float.title_max_fs')) + .fontWeight(BaseCommon.FONT_WEIGHT_700) + .fontColor($r('app.color.title_font_color')) + Text($r('app.string.ran_sub_title')) + .fontSize($r('app.float.sub_title_fs')) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.title_font_color')) + .opacity(Common.SUBTITLE_OPACITY) + .visibility(this.titleMarginTop === MIN_MARGIN_TOP ? Visibility.None : Visibility.Visible) + } + .margin({ + top: `${this.titleMarginTop}vp` + }) + .width(BaseCommon.FULL_PERCENT) + + Scroll() { + Swiper() { + ForEach(BaseCommon.RANK_TITLE_LIST, (item: ResourceStr, index: number) => { + HotListView({ + groupTitle: item, + index: index + }) + .margin({ + top: this.titleMarginTop === MIN_MARGIN_TOP ? + $r('app.float.hot_list_view_min_mt') : $r('app.float.hot_list_view_max_mt') + }) + .width(this.currentBreakpoint === Breakpoint.BREAKPOINT_SM ? + BaseCommon.FULL_PERCENT : $r('app.float.zero')) + .padding({ + left: new BreakpointType($r('app.float.window_padding_left_sm'), + $r('app.float.window_padding_left_md'), $r('app.float.window_padding_left_lg') + ).getValue(this.currentBreakpoint) + }) + }, (item: string) => JSON.stringify(item)) + } + .displayCount(this.getDisplayCount()) + .indicator(false) + .loop(true) + .nextMargin(new BreakpointType($r('app.float.swiper_next_margin_sm'), $r('app.float.swiper_next_margin_md'), + $r('app.float.swiper_next_margin_lg')).getValue(this.currentBreakpoint)) + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + .onChange((index: number) => { + this.index = index; + }) + } + .scrollBar(BarState.Off) + .onScrollFrameBegin((offset: number, state: ScrollState) => { + return { offsetRemain: this.calcMarginTop(offset) }; + }) + .layoutWeight(1) + } + + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.back_icon_width')) + .aspectRatio(1) + .onClick(() => { + this.pageInfos.pop(); + }) + + Image($r('app.media.ic_public_more')) + .width($r('app.float.more_icon_width')) + .aspectRatio(1) + } + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + top: $r('app.float.tool_line_pt'), + left: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.window_padding_left_sm'), $r('app.float.window_padding_left_md'), + $r('app.float.window_padding_left_lg')).getValue(this.currentBreakpoint) + }) + .width(BaseCommon.FULL_PERCENT) + } + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + .alignContent(Alignment.Top) + .backgroundColor($r('app.color.background_color')) + } + .height(BaseCommon.FULL_PERCENT) + .width(BaseCommon.FULL_PERCENT) + } + + getDisplayCount() { + if (this.currentBreakpoint === Breakpoint.BREAKPOINT_SM) { + return 1; + } else if (this.currentBreakpoint === Breakpoint.BREAKPOINT_MD) { + return 2; + } else { + return 3; + } + } + + calcMarginTop(offset: number): number { + let realOffset: number = offset; + if (offset > 0 && this.titleMarginTop > MIN_MARGIN_TOP) { + let tmpOffset = this.titleMarginTop - offset; + let marginOffset: number = tmpOffset > MIN_MARGIN_TOP ? offset : this.titleMarginTop - MIN_MARGIN_TOP; + this.titleMarginTop -= marginOffset; + return 0; + } + + if (offset < 0 && this.titleMarginTop < MAX_MARGIN_TOP) { + let tmpOffset = this.titleMarginTop + Math.abs(offset); + let marginOffset = tmpOffset > MAX_MARGIN_TOP ? MAX_MARGIN_TOP - this.titleMarginTop : Math.abs(offset); + this.titleMarginTop += marginOffset; + return 0; + } + + return realOffset; + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/module.json5 b/MultiCommunityApplication/features/rank/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ddda4a1dd93f4b633e7a342b9bd5d3a1e6a4c8eb --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "rank", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/resources/base/element/color.json b/MultiCommunityApplication/features/rank/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..7d4e6ac3fabe85f04a795be3dc7a374038332acf --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/resources/base/element/color.json @@ -0,0 +1,36 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "title_font_color", + "value": "#E6000000" + }, + { + "name": "background_color", + "value": "#F2F2F2" + }, + { + "name": "top_three_color", + "value": "#FD2704" + }, + { + "name": "normal_index_color", + "value": "#66000000" + }, + { + "name": "content_color", + "value": "#66000000" + }, + { + "name": "click_count_color", + "value": "#66000000" + }, + { + "name": "group_item_title_font_color", + "value": "#444444" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/resources/base/element/float.json b/MultiCommunityApplication/features/rank/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f92763f0646fad63c477892747d9c01ab939636a --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/resources/base/element/float.json @@ -0,0 +1,176 @@ +{ + "float": [ + { + "name": "background_height", + "value": "160vp" + }, + { + "name": "title_max_fs", + "value": "32fp" + }, + { + "name": "title_normal_fs", + "value": "24fp" + }, + { + "name": "sub_title_fs", + "value": "12fp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "hot_list_view_min_mt", + "value": "8vp" + }, + { + "name": "hot_list_view_max_mt", + "value": "20vp" + }, + { + "name": "swiper_next_margin_sm", + "value": "56vp" + }, + { + "name": "swiper_next_margin_md", + "value": "64vp" + }, + { + "name": "swiper_next_margin_lg", + "value": "72vp" + }, + { + "name": "hot_rank_scroll_pl", + "value": "16vp" + }, + { + "name": "back_icon_width", + "value": "24vp" + }, + { + "name": "more_icon_width", + "value": "24vp" + }, + { + "name": "tool_line_pt", + "value": "46vp" + }, + { + "name": "tool_line_pl", + "value": "16vp" + }, + { + "name": "index_font_size", + "value": "14fp" + }, + { + "name": "index_width", + "value": "19vp" + }, + { + "name": "list_item_icon_width", + "value": "48vp" + }, + { + "name": "state_icon_margin_left", + "value": "4vp" + }, + { + "name": "rank_item_font_size", + "value": "14fp" + }, + { + "name": "state_icon_height", + "value": "16vp" + }, + { + "name": "content_font_size", + "value": "12fp" + }, + { + "name": "item_title_margin_left", + "value": "8vp" + }, + { + "name": "item_icon_margin_left", + "value": "8vp" + }, + { + "name": "click_count_font_size", + "value": "12fp" + }, + { + "name": "up_down_icon_width", + "value": "16vp" + }, + { + "name": "top_three_height", + "value": "72vp" + }, + { + "name": "normal_item_height", + "value": "44vp" + }, + { + "name": "group_item_title_font_size", + "value": "16fp" + }, + { + "name": "group_item_title_ml", + "value": "7vp" + }, + { + "name": "group_item_title_height", + "value": "28vp" + }, + { + "name": "group_item_title_mt", + "value": "12vp" + }, + { + "name": "rank_list_rd", + "value": "10vp" + }, + { + "name": "item_icon_br", + "value": "10vp" + }, + { + "name": "up_down_icon_mr", + "value": "10vp" + }, + { + "name": "index_width_normal", + "value": "9vp" + }, + { + "name": "index_width_more", + "value": "17vp" + }, + { + "name": "index_icon_gap_normal", + "value": "4vp" + }, + { + "name": "window_padding_left_sm", + "value": "16vp" + }, + { + "name": "window_padding_left_md", + "value": "24vp" + }, + { + "name": "window_padding_left_lg", + "value": "32vp" + }, + { + "name": "icon_name_margin_left", + "value": "8vp" + }, + { + "name": "hot_list_pl", + "value": "9vp" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/resources/base/element/string.json b/MultiCommunityApplication/features/rank/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..782e6e38554e118cba7777c2527d162a24528b29 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "rank_title", + "value": "热搜榜单" + }, + { + "name": "ran_sub_title", + "value": "最新最热大事件都在这" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/features/rank/src/main/resources/base/media/ic_public_more.svg b/MultiCommunityApplication/features/rank/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..1a635b80d5cacfebb7c57718ef7811ba2debe556 --- /dev/null +++ b/MultiCommunityApplication/features/rank/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,24 @@ + + + public_ic_more_24x24 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/hvigor/hvigor-config.json5 b/MultiCommunityApplication/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 --- /dev/null +++ b/MultiCommunityApplication/hvigor/hvigor-config.json5 @@ -0,0 +1,5 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/oh-package.json5 b/MultiCommunityApplication/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..67579502e26f99f3950665835c6e1cb22a188458 --- /dev/null +++ b/MultiCommunityApplication/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + + }, + "author": "", + "name": "multicommunityapplication", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiCommunityApplication/products/phone/build-profile.json5 b/MultiCommunityApplication/products/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..da1e864745177ec7d3786ade0b6950aba4ebcc4f --- /dev/null +++ b/MultiCommunityApplication/products/phone/build-profile.json5 @@ -0,0 +1,27 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/hvigorfile.ts b/MultiCommunityApplication/products/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiCommunityApplication/products/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiCommunityApplication/products/phone/obfuscation-rules.txt b/MultiCommunityApplication/products/phone/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiCommunityApplication/products/phone/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/oh-package.json5 b/MultiCommunityApplication/products/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f487bc32b6e80d73804fc0bc373d2d232c521c70 --- /dev/null +++ b/MultiCommunityApplication/products/phone/oh-package.json5 @@ -0,0 +1,17 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "hot": "file:../../features/hot", + "base": "file:../../commons/base", + "detail": "file:../../features/detail", + "rank": "file:../../features/rank", + "picture": "file:../../features/picture" + } +} diff --git a/MultiCommunityApplication/products/phone/src/main/ets/entryability/EntryAbility.ets b/MultiCommunityApplication/products/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7ad56a678171219b753afa3aa139376b9afdab2 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UIAbility, Want, AbilityConstant } from '@kit.AbilityKit'; +import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window, display } from '@kit.ArkUI'; +import { CommonConstants as BaseCommon, BreakpointConstants } from 'base' + +export default class EntryAbility extends UIAbility { + + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow((err: BusinessError, data) => { + if (err.code) { + hilog.info(0x0000, 'testTag', '%{public}s', 'getMainWindow failed'); + return; + } + if (deviceInfo.deviceType !== BaseCommon.DEVICE_2IN1) { + data.setWindowLayoutFullScreen(true); + } + this.updateBreakpoint(data.getWindowProperties().windowRect.width); + data.on('windowSizeChange', (windowSize: window.Size) => { + this.updateBreakpoint(windowSize.width); + }) + }) + + windowStage.loadContent('pages/MainPage', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } + + private updateBreakpoint(windowWidth: number) :void{ + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < BreakpointConstants.BREAKPOINT_RANGES[1]) { + curBp = BreakpointConstants.BREAKPOINT_SM; + } else if (windowWidthVp < BreakpointConstants.BREAKPOINT_RANGES[2]) { + curBp = BreakpointConstants.BREAKPOINT_MD; + } else { + curBp = BreakpointConstants.BREAKPOINT_LG; + } + AppStorage.setOrCreate('currentBreakpoint', curBp); + } +} diff --git a/MultiCommunityApplication/products/phone/src/main/ets/model/TabBarModel.ets b/MultiCommunityApplication/products/phone/src/main/ets/model/TabBarModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..30aad6d43c0e8300bf235367b6f5e0e9fd6ee3c4 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/ets/model/TabBarModel.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023 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 interface BarItemInterface { + /** + * Name of the tab. + */ + name: Resource; + + /** + * Icon of the tab. + */ + icon: Resource; + + /** + * Icon selected. + */ + iconSelected: Resource; +} + +export const TabBarsInfo: BarItemInterface[] = [ + { + name: $r('app.string.main'), + icon: $r('app.media.ic_main_off'), + iconSelected: $r('app.media.ic_main_on') + }, + { + name: $r('app.string.hot'), + icon: $r('app.media.ic_hot_point_off'), + iconSelected: $r('app.media.ic_hot_point_on') + }, + { + name: $r('app.string.message'), + icon: $r('app.media.ic_message_off'), + iconSelected: $r('app.media.ic_message_on') + }, + { + name: $r('app.string.mine'), + icon: $r('app.media.ic_mine_off'), + iconSelected: $r('app.media.ic_mine_on') + } +] \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/ets/pages/MainPage.ets b/MultiCommunityApplication/products/phone/src/main/ets/pages/MainPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0427748ccb33e011a39511f423883d05891b538 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/ets/pages/MainPage.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as Common } from 'base'; +import { DetailPage } from 'detail'; +import { HotRankPage } from 'rank'; +import { PictureDetail } from 'picture'; +import { TabContentView } from '../view/TabContentView'; + +@Entry +@Component +struct Index { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_LG; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + + aboutToAppear(): void { + this.pageInfos.pushPath({ name: 'mainPage' }); + } + + @Builder + pageMap(name: string, param: number) { + if ('rankPage' === name) { + NavDestination() { + HotRankPage() + } + .hideTitleBar(true) + } else if ('mainPage' === name) { + NavDestination() { + Column() { + TabContentView() + } + .width(Common.FULL_PERCENT) + .height(Common.FULL_PERCENT) + } + .hideTitleBar(true) + } else if ('detailPage' === name) { + NavDestination() { + DetailPage() + } + .onBackPressed(()=>{ + AppStorage.setOrCreate('isDetailPage', false); + return false; + }) + .hideTitleBar(true) + } else if ('pictureDetail' === name) { + NavDestination() { + PictureDetail({ index: param }) + } + .hideTitleBar(true) + } + } + + build() { + Navigation(this.pageInfos) + .hideNavBar(true) + .navDestination(this.pageMap) + .width(Common.FULL_PERCENT) + .height(Common.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/ets/view/TabContentView.ets b/MultiCommunityApplication/products/phone/src/main/ets/view/TabContentView.ets new file mode 100644 index 0000000000000000000000000000000000000000..59febd64933f0b636557f624d2ee9f199d1dcd71 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/ets/view/TabContentView.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants as Breakpoint, CommonConstants as Common } from 'base'; +import { HotPointPage } from 'hot'; +import { BarItemInterface } from '../model/TabBarModel'; +import { TabBarViewModel } from '../viewmodel/TabBarViewModel'; + +@Component +export struct TabContentView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = Breakpoint.BREAKPOINT_LG; + @State currentIndex: number = 1; + tabBarsInfo: TabBarViewModel = new TabBarViewModel(); + + @Builder + TabBarBuilder(item: BarItemInterface, index: number) { + Column() { + Image(index !== this.currentIndex ? item.icon : item.iconSelected) + .width($r('app.float.icon_tab_width')) + .aspectRatio(1) + Text(item.name) + .fontSize($r('app.float.tab_font_size')) + .fontWeight(Common.FONT_WEIGHT_500) + .fontColor(index === this.currentIndex ? $r('app.color.tab_select_color') : $r('app.color.tab_normal_color')) + } + .height(Common.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + } + + @Builder + DefaultTabBuilder(name: Resource) { + Column() { + Text(name) + .fontSize($r('app.float.default_tab_font_size')) + .fontWeight(Common.FONT_WEIGHT_700) + } + .justifyContent(FlexAlign.Center) + .width(Common.FULL_PERCENT) + .height(Common.FULL_PERCENT) + .backgroundColor(Color.White) + } + + build() { + Column() { + Tabs({ + barPosition: this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End, + index: this.currentIndex + }) { + TabContent() { + this.DefaultTabBuilder($r('app.string.main')) + } + .tabBar(this.TabBarBuilder(this.tabBarsInfo.getTabList()[0], 0)) + + TabContent() { + HotPointPage() + } + .tabBar(this.TabBarBuilder(this.tabBarsInfo.getTabList()[1], 1)) + + TabContent() { + this.DefaultTabBuilder($r('app.string.message')) + } + .tabBar(this.TabBarBuilder(this.tabBarsInfo.getTabList()[2], 2)) + + TabContent() { + this.DefaultTabBuilder($r('app.string.mine')) + } + .tabBar(this.TabBarBuilder(this.tabBarsInfo.getTabList()[3], 3)) + } + .vertical(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG) + .onChange((index: number) => { + this.currentIndex = index; + }) + .barHeight(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? Common.HALF_PERCENT : $r('app.float.bar_height')) + .barWidth(this.currentBreakpoint === Breakpoint.BREAKPOINT_LG ? + $r('app.float.tab_bar_width') : Common.FULL_PERCENT) + .scrollable(false) + .height(Common.FULL_PERCENT) + } + .backgroundColor($r('app.color.bar_background_color')) + .padding({ bottom: this.currentBreakpoint !== Breakpoint.BREAKPOINT_LG ? + $r('app.float.tab_content_pb') : $r('app.float.zero') }) + .height(Common.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/ets/viewmodel/TabBarViewModel.ets b/MultiCommunityApplication/products/phone/src/main/ets/viewmodel/TabBarViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcde0514f5b727974f1d4676b55d913a78a172a0 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/ets/viewmodel/TabBarViewModel.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BarItemInterface, TabBarsInfo } from '../model/TabBarModel'; + +export class TabBarViewModel { + private tabList: BarItemInterface[] = TabBarsInfo; + + getTabList(): BarItemInterface[] { + return this.tabList; + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/module.json5 b/MultiCommunityApplication/products/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fd31b21d26f919a0f0883acb1059dd197b790f36 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/module.json5 @@ -0,0 +1,42 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 340, + "minWindowHeight": 600, + "maxWindowWidth": 1280, + "maxWindowHeight": 800, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/element/color.json b/MultiCommunityApplication/products/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..b6eae545270a26ec79506e84385541eec105398c --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/element/color.json @@ -0,0 +1,20 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "tab_normal_color", + "value": "#7F7F7F" + }, + { + "name": "tab_select_color", + "value": "#0A59F7" + }, + { + "name": "bar_background_color", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/element/float.json b/MultiCommunityApplication/products/phone/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..24eedaffc85e3bc0a29dcfc8418b5c3c299ecbf5 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/element/float.json @@ -0,0 +1,130 @@ +{ + "float": [ + { + "name": "icon_tab_width", + "value": "24vp" + }, + { + "name": "tab_font_size", + "value": "12fp" + }, + + { + "name": "page_padding", + "value": "12vp" + }, + { + "name": "small_text_size", + "value": "12fp" + }, + { + "name": "normal_text_size", + "value": "14fp" + }, + { + "name": "splash_normal_text_size", + "value": "16fp" + }, + { + "name": "title_text_size", + "value": "20fp" + }, + { + "name": "splash_title_text_size", + "value": "24fp" + }, + { + "name": "tool_bar_height", + "value": "56vp" + }, + { + "name": "tool_bar_margin", + "value": "-56vp" + }, + + { + "name": "tab_border_width", + "value": "0.5vp" + }, + { + "name": "tab_img_size", + "value": "22vp" + }, + { + "name": "tab_big_img_width", + "value": "32vp" + }, + { + "name": "tab_big_img_height", + "value": "37vp" + }, + { + "name": "tab_margin", + "value": "-15vp" + }, + { + "name": "tab_title_margin", + "value": "5vp" + }, + { + "name": "splash_swiper_indicator", + "value": "5vp" + }, + { + "name": "button_weight", + "value": "500vp" + }, + { + "name": "button_opacity", + "value": "0.8vp" + }, + { + "name": "button_width", + "value": "312vp" + }, + { + "name": "button_height", + "value": "40vp" + }, + { + "name": "button_borderRadius", + "value": "20vp" + }, + { + "name": "button_margin", + "value": "650vp" + }, + { + "name": "image_width", + "value": "300vp" + }, + { + "name": "text_opacity", + "value": "0.7vp" + }, + { + "name": "test_margin", + "value": "5vp" + }, + { + "name": "tab_bar_width", + "value": "96vp" + }, + { + "name": "default_tab_font_size", + "value": "30fp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "bar_height", + "value": "54vp" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/element/string.json b/MultiCommunityApplication/products/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7bb4d2ed68950530c1d00c347bad3351d31c7d8e --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "entry ability description" + }, + { + "name": "EntryAbility_label", + "value": "MultiCommunityApplication" + }, + { + "name": "hot", + "value": "Hot" + }, + { + "name": "main", + "value": "Main" + }, + { + "name": "message", + "value": "Message" + }, + { + "name": "mine", + "value": "Mine" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/background.png b/MultiCommunityApplication/products/phone/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/MultiCommunityApplication/products/phone/src/main/resources/base/media/background.png differ diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/foreground.png b/MultiCommunityApplication/products/phone/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/MultiCommunityApplication/products/phone/src/main/resources/base/media/foreground.png differ diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_off.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..70b6098142b04e49ef3bcfd92952af60acf0c16b --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_off.svg @@ -0,0 +1,23 @@ + + + phone_diBuTab_cell_2 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_on.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..0d59ea15d1b1ac3a295a9e5c6efd4a8ebc47d905 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_hot_point_on.svg @@ -0,0 +1,23 @@ + + + phone_diBuTab_cell_2 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_off.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..0f1e0d70425df7b22c694cb3560cd8d199b61342 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_off.svg @@ -0,0 +1,12 @@ + + + phone_diBuTab_cell_5 + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_on.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..236a1d933bca4152d7277fe10a9dc2888f89e7c8 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_main_on.svg @@ -0,0 +1,12 @@ + + + phone_diBuTab_cell_5 + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_off.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..d9482c7bf6ef148f265ce46529e87b90b4565e58 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_off.svg @@ -0,0 +1,23 @@ + + + phone_diBuTab_cell_3 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_on.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..b5ae07e41056acc1e24b7035700fa135b4678ccb --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_message_on.svg @@ -0,0 +1,23 @@ + + + phone_diBuTab_cell_3 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_off.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..ef6e4e1b7f59a7f47954afa704290d906a24bf1e --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_off.svg @@ -0,0 +1,19 @@ + + + phone_diBuTab_cell_4 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_on.svg b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..1e7cd0b75ae0c14a5d3e2a507063d1472fa2f53b --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/ic_mine_on.svg @@ -0,0 +1,19 @@ + + + phone_diBuTab_cell_4 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/icon.png b/MultiCommunityApplication/products/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiCommunityApplication/products/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/layered_image.json b/MultiCommunityApplication/products/phone/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/media/startIcon.png b/MultiCommunityApplication/products/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/MultiCommunityApplication/products/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiCommunityApplication/products/phone/src/main/resources/base/profile/main_pages.json b/MultiCommunityApplication/products/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..f4241ef2f72e78047b4c449d92bd1a92accc39fb --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/MainPage" + ] +} diff --git a/MultiCommunityApplication/products/phone/src/main/resources/en_US/element/string.json b/MultiCommunityApplication/products/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7bb4d2ed68950530c1d00c347bad3351d31c7d8e --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "entry ability description" + }, + { + "name": "EntryAbility_label", + "value": "MultiCommunityApplication" + }, + { + "name": "hot", + "value": "Hot" + }, + { + "name": "main", + "value": "Main" + }, + { + "name": "message", + "value": "Message" + }, + { + "name": "mine", + "value": "Mine" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/products/phone/src/main/resources/zh_CN/element/string.json b/MultiCommunityApplication/products/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..586f543b073a91a31122cac00a08c02b25ebd382 --- /dev/null +++ b/MultiCommunityApplication/products/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "entry ability description" + }, + { + "name": "EntryAbility_label", + "value": "一多开发实例-社区评论" + }, + { + "name": "hot", + "value": "热点" + }, + { + "name": "main", + "value": "首页" + }, + { + "name": "message", + "value": "消息" + }, + { + "name": "mine", + "value": "我的" + } + ] +} \ No newline at end of file diff --git a/MultiCommunityApplication/screenshots/device/foldable.en.png b/MultiCommunityApplication/screenshots/device/foldable.en.png new file mode 100644 index 0000000000000000000000000000000000000000..f8821edb46a1adc8bf9180e00feed2e9f428eaaf Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/foldable.en.png differ diff --git a/MultiCommunityApplication/screenshots/device/foldable.png b/MultiCommunityApplication/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..2c39bdfc05d2a828a710a6ee3e8851a86aa3d631 Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/foldable.png differ diff --git a/MultiCommunityApplication/screenshots/device/pad.en.png b/MultiCommunityApplication/screenshots/device/pad.en.png new file mode 100644 index 0000000000000000000000000000000000000000..4344d9f87a228805af4325602c59b07684903781 Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/pad.en.png differ diff --git a/MultiCommunityApplication/screenshots/device/pad.png b/MultiCommunityApplication/screenshots/device/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..b56984c00f6664c9cf44821a8535553dc31439d8 Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/pad.png differ diff --git a/MultiCommunityApplication/screenshots/device/phone.en.png b/MultiCommunityApplication/screenshots/device/phone.en.png new file mode 100644 index 0000000000000000000000000000000000000000..f9b4b6e98e8ef2a29d3b452fde326b2e9d7809fe Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/phone.en.png differ diff --git a/MultiCommunityApplication/screenshots/device/phone.png b/MultiCommunityApplication/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..856563dc0760f92188a244366729c9cb6310cc3a Binary files /dev/null and b/MultiCommunityApplication/screenshots/device/phone.png differ diff --git a/MultiDeviceCommunication/AppScope/app.json5 b/MultiDeviceCommunication/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..868bf66ee98c0dc0ee4cdac832beb3188441970f --- /dev/null +++ b/MultiDeviceCommunication/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.multdevicecommunication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/MultiDeviceCommunication/AppScope/resources/base/element/string.json b/MultiDeviceCommunication/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..74e3264342d55250836764259c9d24fafd6c1dc8 --- /dev/null +++ b/MultiDeviceCommunication/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultDeviceCommunication" + } + ] +} diff --git a/MultiDeviceCommunication/AppScope/resources/base/media/app_icon.png b/MultiDeviceCommunication/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiDeviceCommunication/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiDeviceCommunication/README.en.md b/MultiDeviceCommunication/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..3fe01b6c723b98012117f645a531ba33255460c4 --- /dev/null +++ b/MultiDeviceCommunication/README.en.md @@ -0,0 +1,43 @@ +# Instant Messaging + +### Introduction + +Learn to implement an instant messaging app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. + +#### Description + +This codelab implements an instant messaging app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. It uses the three-layer project architecture for code reuse and tailors the pages to different device sizes such as mobile phones, foldable phones, and PC/2-in-1 devices. +The following figure shows the effect on the mobile phone: + +![](screenshots/device/phone_EN.png) + +The following figure shows the effect on the foldable phone in unfolded state: + +![](screenshots/device/foldable_EN.png) + +The following figure shows the effect on the PC/2-in-1 device: + +![](screenshots/device/pad_EN.png) + +#### Concepts + +- One-time development for multi-device deployment: It enables you to develop and release one set of project code for deployment on multiple devices as demanded. This feature enables you to efficiently develop applications that are compatible with multiple devices while providing distributed user experiences for cross-device transferring, migration, and collaboration. +- Adaptive layout: When the size of an external container changes, elements can automatically change based on the relative relationship to adapt to the external container. Relative relationships include the proportion, fixed aspect ratio, and display priority. Common adaptive layouts include linear, stacking, flexbox, and relative layouts. These capabilities enable the GUI to continuously change with the size of the external container. +- Responsive layout: When the size of an external container changes, elements can automatically change based on the breakpoints, grids, or specific features (such as the screen direction and window width and height) to adapt to the external container. +- Navigation: This component is the root container of pages, usually used in the split-view layout. + +#### Permissions + +N/A. + +#### How to Use + +- Install and open an app on a mobile phone, foldable phone, or tablet. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +- Tap Message, Contacts, or Social Circle at the bottom to switch to the corresponding tab page. By default, the Message tab page is displayed. + +#### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later +3. DevEco Studio: DevEco Studio 5.0.0 Release or later +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later \ No newline at end of file diff --git a/MultiDeviceCommunication/README.md b/MultiDeviceCommunication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c7b62faf9eba12684861752081fc70f376fd08fc --- /dev/null +++ b/MultiDeviceCommunication/README.md @@ -0,0 +1,43 @@ +# 一次开发,多端部署-即时通讯 + +### 简介 + +基于自适应和响应式布局,实现一次开发,多端部署-即时通讯。 + +#### 介绍 + +本篇Codelab基于自适应布局和响应式布局,实现一次开发,多端部署的即时通讯页面。通过“三层工程架构”实现代码复用,并根据手机、折叠屏以及PC/2in1不同的设备尺寸设计对应页面。 +手机效果如图所示: + +![](screenshots/device/phone.png) + +折叠屏展开态效果如图所示: + +![](screenshots/device/foldable.png) + +PC/2in1效果如图所示: + +![](screenshots/device/pad.png) + +#### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 自适应布局:当外部容器大小发生变化时,元素可以根据相对关系自动变化以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。常见的自适应布局有:线性布局、层叠布局、弹性布局、相对布局等。自适应布局能力可以实现界面显示随外部容器大小连续变化。 +- 响应式布局:当外部容器大小发生变化时,元素可以根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化以适应外部容器变化的布局能力。 +- Navigation:页面根容器,一般用于分栏布局场景使用。 + +#### 相关权限 + +不涉及。 + +#### 使用说明 + +- 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +- 点击底部消息、通讯录、社交圈,将切换显示对应的标签页,默认显示消息标签页。 + +#### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 diff --git a/MultiDeviceCommunication/build-profile.json5 b/MultiDeviceCommunication/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..bd41395f6fc231e92da61dafe8e1cefeeeceefc6 --- /dev/null +++ b/MultiDeviceCommunication/build-profile.json5 @@ -0,0 +1,71 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./products/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "home", + "srcPath": "./features/home", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "socialCircle", + "srcPath": "./features/socialCircle", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./common/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/Index.ets b/MultiDeviceCommunication/common/base/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8522a80c3704c0cdd74d44bbc4b2b1ec2efe6a3 --- /dev/null +++ b/MultiDeviceCommunication/common/base/Index.ets @@ -0,0 +1,20 @@ +export { BreakpointConstants } from "./src/main/ets/constants/BreakpointConstants"; + +export { TabInfoModel } from "./src/main/ets/viewmodel/CommonViewModel"; + +export { TabText } from "./src/main/ets/views/text/TabText"; + +export { IntroduceText } from "./src/main/ets/views/text/IntroduceText"; + +export { StandardIcon } from "./src/main/ets/views/image/StandardIcon"; + +export { NormalText } from "./src/main/ets/views/text/NormalText"; + +export { BreakpointType } from "./src/main/ets/utils/Breakpoint/BreakpointType"; + +export { default as Logger } from "./src/main/ets/utils/Logger/Logger"; + +export { BaseConstants, CurrentFeature, CurrentPage,DeviceTypes } from "./src/main/ets/constants/BaseConstants"; + +export { Adaptive } from "./src/main/ets/viewmodel/AdaptiveViewModel"; + diff --git a/MultiDeviceCommunication/common/base/build-profile.json5 b/MultiDeviceCommunication/common/base/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiDeviceCommunication/common/base/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/hvigorfile.ts b/MultiDeviceCommunication/common/base/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiDeviceCommunication/common/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiDeviceCommunication/common/base/obfuscation-rules.txt b/MultiDeviceCommunication/common/base/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiDeviceCommunication/common/base/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/oh-package.json5 b/MultiDeviceCommunication/common/base/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c764a93a96ab677a53c95087b3858bd0524e4e76 --- /dev/null +++ b/MultiDeviceCommunication/common/base/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiDeviceCommunication/common/base/src/main/ets/constants/BaseConstants.ets b/MultiDeviceCommunication/common/base/src/main/ets/constants/BaseConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..06f0d45311844d2f84649376f9101155ada1b4ca --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/constants/BaseConstants.ets @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2023 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 class BaseConstants { + /** + * Component size + */ + static readonly FULL_PERCENT: string = '100%'; + static readonly FULL_SIZE: string = '100%'; + static readonly FULL_HEIGHT: string = '100%'; + static readonly FULL_WIDTH: string = '100%'; + static readonly NINETY_WIDTH_PERCENT: string = '90%'; + static readonly IMAGE_ONE_WIDTH_SM: string = '66.6%'; + static readonly IMAGE_ONE_WIDTH_MD: string = '63.8%'; + static readonly IMAGE_ONE_WIDTH_LG: string = '32.1%'; + static readonly TAB_PADDING_TOP: string = '28.6%' + static readonly TAB_PADDING_BOTTOM: string = '28.6%' + static readonly HOME_LIST_WIDTH: string = '37%' + static readonly APPLET_LIST_WIDTH: string = '37%' + static readonly IMAGE_ONE_ASPECT_RATIO: number = 1.33; + static readonly SMALL_MINI_FONT_SIZE: Resource = $r('app.float.smaller_mini_font_size'); + /** + * Text property + */ + static readonly FONT_FAMILY_SEMI_BOLD: Resource = $r('app.float.font_family_semi_bold'); + static readonly FONT_FAMILY_NORMAL: Resource = $r('app.float.font_family_normal'); + static readonly FONT_FAMILY_BOLD: Resource = $r('app.float.font_family_bold'); + static readonly FONT_FAMILY_MEDIUM: Resource = $r('app.float.font_family_medium'); + static readonly FONT_WEIGHT_SEVEN: number = 700; + static readonly FONT_WEIGHT_SIX: number = 600; + static readonly FONT_WEIGHT_FIVE: number = 500; + static readonly FONT_WEIGHT_FOUR: number = 400; + static readonly FONT_SIZE_TEN: Resource = $r('app.float.font_size_ten'); + static readonly FONT_SIZE_ELEVEN: Resource = $r('app.float.font_size_eleven'); + static readonly FONT_SIZE_TWELVE: Resource = $r('app.float.font_size_twelve'); + static readonly FONT_SIZE_FOURTEEN: Resource = $r('app.float.font_size_fourteen'); + static readonly FONT_SIZE_SIXTEEN: Resource = $r('app.float.font_size_sixteen'); + static readonly FONT_SIZE_EIGHTEEN: Resource = $r('app.float.font_size_eighteen'); + static readonly FONT_SIZE_TWENTY: Resource = $r('app.float.font_size_twenty'); + static readonly FONT_SIZE_TWENTY_FOUR: Resource = $r('app.float.font_size_twenty_four'); + static readonly FONT_SIZE_THIRTY_TWO: Resource = $r('app.float.font_size_thirty_two'); + /** + * Application about + */ + static readonly SPLIT_DOCUMENT_SCREEN = false; + static readonly SPLIT_APPLET_SCREEN = false; + /** + * Flex about + */ + static readonly FLEX_GROW_ONE = 1; + static readonly LAYOUT_WEIGHT_ONE = 1; + static readonly FLEX_SHRINK_ZERO = 0; + static readonly FLEX_SHRINK_ONE = 1; + /** + * HomeTab + */ + static readonly HOME_TAB_HEIGHT_SM: string = '56vp'; + static readonly HOME_TAB_HEIGHT_MD: string = '56vp'; + static readonly HOME_TAB_HEIGHT_LG: string = '100%'; + static readonly HOME_TAB_WIDTH_SM: string = '100%'; + static readonly HOME_TAB_WIDTH_MD: string = '100%'; + static readonly HOME_TAB_WIDTH_LG: string = '96vp'; + static readonly CONTACTS_PHONE_WIDTH_SM: string = '27%'; + static readonly CONTACTS_PHONE_WIDTH_MD: string = '28%'; + static readonly CONTACTS_PHONE_WIDTH_LG: string = '25%'; + static readonly CONTACTS_DETAIL_HEIGHT_SM: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_MD: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_LG: string = '90%'; + static readonly CONTACTS_ITEM_HEIGHT_SM: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_MD: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_LG: string = '10%'; + /** + * Document tab + */ + static readonly DOCUMENT_TITLE_HEIGHT_SM: string = '33%'; + static readonly DOCUMENT_TITLE_HEIGHT_MD: string = '58%'; + static readonly DOCUMENT_TITLE_HEIGHT_LG: string = '100%'; + static readonly DOCUMENT_TITLE_SPACE_SM: number = 32; + static readonly DOCUMENT_TITLE_SPACE_MD: number = 56; + static readonly DOCUMENT_TITLE_SPACE_LG: number = 103; + /** + * Component opacity value: 1. + */ + static readonly FULL_OPACITY: number = 1; + /** + * Component opacity value: 0.6. + */ + static readonly SIXTY_OPACITY: number = 0.6; + /** + * Device grid column list. + */ + static readonly DEVICE_GRID_COLUMNS: string[] = ['1fr 1fr', '1fr 1fr 1fr', '1fr 1fr 1fr 1fr', '1fr 1fr 1fr 1fr 1fr', + '1fr 1fr 1fr 1fr 1fr 1fr 1fr']; + /** + * Device PC/2in1. + */ + static readonly DEVICE_2IN1: string = '2in1'; +} + +/** + * Current feature home, applet or document + */ +export enum CurrentFeature { + HOME = 0, + APPLET = 1, + DOCUMENT = 2 +} + +/** + * Current page home,conversation or socialCircle + */ +export enum CurrentPage { + HOME = 0, + CONVERSATION = 1, + SOCIAL_CIRCLE = 2, + ME = 3 +} + +export enum DeviceTypes { + PHONE = 'phone', + TABLET = 'tablet', + "2IN1" = '2in1', +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/constants/BreakpointConstants.ets b/MultiDeviceCommunication/common/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..39a925fec0febea0394d22485624416137d9a38d --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent smaller device types. + */ + static readonly BREAKPOINT_XS: string = 'xs'; + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_SCOPE: number[] = [0, 320, 600, 840]; + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [12, 15, 4]; + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [12, 6, 7, 5, 3, 4, 2]; +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/utils/Breakpoint/BreakpointType.ets b/MultiDeviceCommunication/common/base/src/main/ets/utils/Breakpoint/BreakpointType.ets new file mode 100644 index 0000000000000000000000000000000000000000..92e7cf2e0e72a772dd0a6d5850dde1d49ae5cfa8 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/utils/Breakpoint/BreakpointType.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '../../constants/BreakpointConstants'; + +export class BreakpointType { + static currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + GetValue(currentBreakpoint: string): T { + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/utils/Logger/Logger.ets b/MultiDeviceCommunication/common/base/src/main/ets/utils/Logger/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..255bed3a8678b55cae91a74900d354c3542d4c57 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/utils/Logger/Logger.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + /** + * constructor. + * + * @param Prefix Identifies the log tag. + * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. + */ + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('MultiDeviceCommunication'); \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/AdaptiveViewModel.ets b/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/AdaptiveViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..c160a4f6bc8dc8f9028ffbd7874db2a12b925a74 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/AdaptiveViewModel.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants as Constants } from '../constants/BaseConstants'; +import { BreakpointType } from '../utils/Breakpoint/BreakpointType'; + +export class Adaptive { + static CircleImageOneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.IMAGE_ONE_WIDTH_SM, + Constants.IMAGE_ONE_WIDTH_MD, + Constants.IMAGE_ONE_WIDTH_LG + ).GetValue(currentBreakpoint); + } + static HomeTabHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_HEIGHT_SM, + Constants.HOME_TAB_HEIGHT_MD, + Constants.HOME_TAB_HEIGHT_LG + ).GetValue(currentBreakpoint); + } + static HomeTabWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_WIDTH_SM, + Constants.HOME_TAB_WIDTH_MD, + Constants.HOME_TAB_WIDTH_LG + ).GetValue(currentBreakpoint); + } + static ContactPhoneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_PHONE_WIDTH_SM, + Constants.CONTACTS_PHONE_WIDTH_MD, + Constants.CONTACTS_PHONE_WIDTH_LG + ).GetValue(currentBreakpoint); + } + static ContactDetailHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_DETAIL_HEIGHT_SM, + Constants.CONTACTS_DETAIL_HEIGHT_MD, + Constants.CONTACTS_DETAIL_HEIGHT_LG + ).GetValue(currentBreakpoint); + } + static ContactItemHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_ITEM_HEIGHT_SM, + Constants.CONTACTS_ITEM_HEIGHT_MD, + Constants.CONTACTS_ITEM_HEIGHT_LG + ).GetValue(currentBreakpoint); + } + static DocumentTitleColumnHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_HEIGHT_SM, + Constants.DOCUMENT_TITLE_HEIGHT_MD, + Constants.DOCUMENT_TITLE_HEIGHT_LG + ).GetValue(currentBreakpoint); + } + static DocumentTitleColumnSpace = (currentBreakpoint: string): number => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_SPACE_SM, + Constants.DOCUMENT_TITLE_SPACE_MD, + Constants.DOCUMENT_TITLE_SPACE_LG + ).GetValue(currentBreakpoint); + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/CommonViewModel.ets b/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/CommonViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..d207df853a16bde3ac4f90bae56348b260bf45d2 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/viewmodel/CommonViewModel.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023 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. + */ + +interface TabInfoModel { + index: number; + img: Resource; + selectImg?: Resource; + title: Resource; +}; + +export { TabInfoModel }; \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/views/image/StandardIcon.ets b/MultiDeviceCommunication/common/base/src/main/ets/views/image/StandardIcon.ets new file mode 100644 index 0000000000000000000000000000000000000000..18597cffd9a0b9618b85d47e86bbae373d335fd4 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/views/image/StandardIcon.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 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. + */ + +@Component +export struct StandardIcon { + @Prop icon: Resource; + + build() { + Image(this.icon) + .width($r('app.float.icon_height_one')) + .height($r('app.float.icon_width_one')) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/views/text/IntroduceText.ets b/MultiDeviceCommunication/common/base/src/main/ets/views/text/IntroduceText.ets new file mode 100644 index 0000000000000000000000000000000000000000..f92eb40b195edea21bd6526b66aa7e2d601297e9 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/views/text/IntroduceText.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { BaseConstants } from '../../constants/BaseConstants'; + +@Component +export struct IntroduceText { + @Prop data: ResourceStr; + @Prop fontSize: Resource = $r('app.float.micro_font_size'); + @Prop fontColor: Resource = $r('app.color.font_color_black_two'); + @Prop fontWeight: number = BaseConstants.FONT_WEIGHT_FOUR; + + build() { + Text(this.data) + .opacity(0.5) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(this.fontSize) + .fontColor(this.fontColor) + .textAlign(TextAlign.Start) + .lineHeight($r('app.float.text_line_height_five')) + .fontWeight(this.fontWeight) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/views/text/NormalText.ets b/MultiDeviceCommunication/common/base/src/main/ets/views/text/NormalText.ets new file mode 100644 index 0000000000000000000000000000000000000000..45e549f7fce688595e5941a2560c82d351240493 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/views/text/NormalText.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants } from '../../constants/BaseConstants'; + +@Component +export struct NormalText { + @Prop data: ResourceStr; + @Prop fontSize: Resource = BaseConstants.FONT_SIZE_TWELVE; + @Prop fontColor: Resource = $r('app.color.font_color_black_two'); + @Prop fontWeight: number = BaseConstants.FONT_WEIGHT_FOUR; + @Prop fontFamily: Resource = BaseConstants.FONT_FAMILY_NORMAL; + + build() { + Text(this.data) + .fontFamily(this.fontFamily) + .fontSize(this.fontSize) + .fontColor(this.fontColor) + .textAlign(TextAlign.Start) + .lineHeight($r('app.float.text_line_height_five')) + .fontWeight(this.fontWeight) + .copyOption(CopyOptions.LocalDevice) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/ets/views/text/TabText.ets b/MultiDeviceCommunication/common/base/src/main/ets/views/text/TabText.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8d6f9cf5e37af7cbaf487c79f22f8ae9c1235a8 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/ets/views/text/TabText.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants } from '../../constants/BaseConstants'; + +@Component +export struct TabText { + @Prop data: string = ''; + @Prop resourceData: Resource; + @Prop fontSize: Resource = BaseConstants.SMALL_MINI_FONT_SIZE; + @Prop fontColor: Resource = $r('app.color.font_color_one'); + @Prop fontWeight: number = BaseConstants.FONT_WEIGHT_FIVE; + @Prop fontFamily: Resource = BaseConstants.FONT_FAMILY_MEDIUM; + + build() { + Text(this.data || this.resourceData) + .fontFamily(this.fontFamily) + .fontSize(this.fontSize) + .fontColor(this.fontColor) + .textAlign(TextAlign.Center) + .lineHeight($r('app.float.text_line_height_five')) + .fontWeight(this.fontWeight) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/module.json5 b/MultiDeviceCommunication/common/base/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5b88767e30950571337935f398f2dcbf4d1b822d --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "base", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/element/color.json b/MultiDeviceCommunication/common/base/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..fbec60e2f19c2f58e547e17add8411e15ae92b4d --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/resources/base/element/color.json @@ -0,0 +1,44 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "focus_color", + "value": "#0A59F7" + }, + { + "name": "background_color_grey", + "value": "#F6F6F6" + }, + { + "name": "background_color_grey_two", + "value": "#F1F3F5" + }, + { + "name": "background_color_grey_three", + "value": "#8A9097" + }, + { + "name": "background_color_pink", + "value": "#FCF7F6" + }, + { + "name": "background_color_icon", + "value": "#F0A6C3" + }, + { + "name": "font_color_one", + "value": "#000000" + }, + { + "name": "font_color_black_two", + "value": "#182431" + }, + { + "name": "line_color", + "value": "#E7E7E7" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/element/float.json b/MultiDeviceCommunication/common/base/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..dd89a96093d4f6238a1350a7070e76c7ae1943fe --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/resources/base/element/float.json @@ -0,0 +1,120 @@ +{ + "float": [ + { + "name": "micro_font_size", + "value": "10fp" + }, + { + "name": "smaller_mini_font_size", + "value": "11fp" + }, + { + "name": "icon_height_one", + "value": "24vp" + }, + { + "name": "icon_width_one", + "value": "24vp" + }, + { + "name": "icon_margin_one", + "value": "12vp" + }, + { + "name": "icon_margin_two", + "value": "24vp" + }, + { + "name": "main_image_size", + "value": "22vp" + }, + { + "name": "main_image_size_lg", + "value": "24vp" + }, + { + "name": "avatar_image_size", + "value": "40vp" + }, + { + "name": "bar_width", + "value": "96vp" + }, + { + "name": "text_line_height_one", + "value": "19fp" + }, + { + "name": "text_line_height_three", + "value": "14fp" + }, + { + "name": "text_line_height_two", + "value": "22fp" + }, + { + "name": "text_line_height_five", + "value": "21fp" + }, + { + "name": "background_color_grey", + "value": "#111111" + }, + { + "name": "input_raduis_one", + "value": "20vp" + }, + { + "name": "font_family_normal", + "value": "HarmonyHeiTi" + }, + { + "name": "font_family_medium", + "value": "HarmonyHeiTi-Medium" + }, + { + "name": "font_family_bold", + "value": "HarmonyHeiTi-Bold" + }, + { + "name": "font_family_semi_bold", + "value": "HarmonyHeiTi-SemiBold" + }, + { + "name": "font_size_ten", + "value": "10fp" + }, + { + "name": "font_size_eleven", + "value": "11fp" + }, + { + "name": "font_size_twelve", + "value": "12fp" + }, + { + "name": "font_size_fourteen", + "value": "14fp" + }, + { + "name": "font_size_sixteen", + "value": "16fp" + }, + { + "name": "font_size_eighteen", + "value": "18fp" + }, + { + "name": "font_size_twenty", + "value": "20fp" + }, + { + "name": "font_size_twenty_four", + "value": "24fp" + }, + { + "name": "font_size_thirty_two", + "value": "32fp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/element/string.json b/MultiDeviceCommunication/common/base/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3e2e28728101a1b92e34e39873b2d80769859b13 --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "test_sm", + "value": "sm" + }, + { + "name": "test_md", + "value": "md" + }, + { + "name": "test_lg", + "value": "lg" + }, + { + "name": "test_aaa", + "value": "11fp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/media/icon.png b/MultiDeviceCommunication/common/base/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceCommunication/common/base/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/media/setting.jpeg b/MultiDeviceCommunication/common/base/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiDeviceCommunication/common/base/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiDeviceCommunication/common/base/src/main/resources/base/profile/main_pages.json b/MultiDeviceCommunication/common/base/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceCommunication/common/base/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceCommunication/features/home/Index.ets b/MultiDeviceCommunication/features/home/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef00decacd90ec409944182b273e656c705751ec --- /dev/null +++ b/MultiDeviceCommunication/features/home/Index.ets @@ -0,0 +1 @@ +export { Index as Home } from "./src/main/ets/pages/Index"; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/build-profile.json5 b/MultiDeviceCommunication/features/home/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiDeviceCommunication/features/home/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/hvigorfile.ts b/MultiDeviceCommunication/features/home/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiDeviceCommunication/features/home/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiDeviceCommunication/features/home/obfuscation-rules.txt b/MultiDeviceCommunication/features/home/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiDeviceCommunication/features/home/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/oh-package.json5 b/MultiDeviceCommunication/features/home/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e70ae9c6719501dac9a3b41f67ffd7b0209d5e0c --- /dev/null +++ b/MultiDeviceCommunication/features/home/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "home", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/base": "file:../../common/base", + "@ohos/socialcircle": "file:../socialCircle" + } +} diff --git a/MultiDeviceCommunication/features/home/src/main/ets/constants/HomeConstants.ets b/MultiDeviceCommunication/features/home/src/main/ets/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..f53610408f567ca3fa421c0fc7ee65d9fbef5113 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/constants/HomeConstants.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 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 class HomeConstants { + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [1, 2, 3, 4, 5]; + static readonly GRID_COL_COLUMNS: number[] = [0, 1, 2, 3, 4, 5]; + static readonly TAB_MESSAGE_INDEX = 0; + /** + * Index of CONTACTS tab. + */ + static readonly TAB_CONTACTS_INDEX = 1; + /** + * Index of SOCIAL_CIRCLE tab. + */ + static readonly TAB_SOCIAL_CIRCLE_INDEX = 2; + /** + * Index of ME tab. + */ + static readonly TAB_ME_INDEX = 3; + static readonly CONTACTS_DETAIL_AVATAR_Z_INDEX = 2; + /** + * Image message + */ + static readonly USER_PHONE = '15988880000'; + static readonly LAST_POST = $r('app.string.news'); + static readonly IMAGES_SCOPE = 2; + static readonly IMAGE_ASPECT_RATIO = 1; + /** + * Contacts list detail + */ + static readonly CONTACTS_NAME = $r('app.string.Contacts'); + static readonly CONTACTS_LIST = [$r('app.string.group'), $r('app.string.card')]; + static readonly CONTACTS_DEFAULT_SELECTED_INDEX = 0; + static readonly CONTACTS_DEFAULT_SELECTED_NAME = $r('app.string.Alan'); + /** + * Conversation detail + */ + static readonly CONVERSATION_LIST_APPLET = [$r('app.string.milk'), $r('app.string.Speed'), $r('app.string.happy')]; + static readonly CONVERSATION_LIST_DOCUMENT = [$r('app.string.plan'), $r('app.string.jack'), $r('app.string.ok')]; + static readonly IS_APPLET_CONVERSATION = true; + static readonly IS_DOCUMENT_CONVERSATION = true; + static readonly IS_RECEIVED = true; + static readonly CONVERSATION_DEFAULT_SIZE = 3; + static readonly CONVERSATION_TITLE = $r('app.string.Message'); + /** + * Conversation top search + */ + static readonly SEARCH_TEXT_FLEX_BASIS = 150; + static readonly SEARCH_TEXT_INPUT = $r('app.string.search'); + static readonly ENABLE_KEY_BOARD_ON_FOCUS = false; + static readonly FLEX_BASIS_AUTO = 'auto'; + /** + * Conversation detail + */ + static readonly CONVERSATION_DETAIL_BOTTOM_TEXT_RADIUS = 20; + static readonly CONVERSATION_DETAIL_TOP_TITLE = '芬芬'; + static readonly CONVERSATION_DETAIL_MAX_LINE = 1; + static readonly CONVERSATION_DETAIL_FILL_OPACITY = 1; + static readonly CONVERSATION_DETAIL_STROKE_WIDTH = 1; + static readonly PATH_BORDER_RADIUS = 8; + /** + * Applet detail + */ + static readonly APPLET_TITLE = '奶茶'; + static readonly APPLET_DESCRIBE = '应用'; + /** + * Document detail + */ + static readonly DOCUMENT_SIZE = '24KB'; + static readonly DOCUMENT_INTRODUCE = $r('app.string.document'); + static readonly DOCUMENT_DIVIDER_WIDTH = 1; + /** + * Default avatar + */ + static readonly DEFAULT_AVATAR = $r('app.media.avatar1') + /** + * Navigation navBarWidth percent + */ + static readonly NAVIGATION_NAV_BAR_WIDTH_MD = '50%' + static readonly NAVIGATION_NAV_BAR_WIDTH_LG = '44.5%' +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsDetail.ets b/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e3c3286a695ab990d180ca96f183ecbaedcb666 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsDetail.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Adaptive, BaseConstants, BreakpointConstants, StandardIcon } from '@ohos/base'; +import { HomeConstants } from '../constants/HomeConstants'; +import { SocialCirclePictures } from '../viewmodel/SocialCircleViewModel'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Component +export struct ContactsDetail { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Prop currentContactUserName: string + @Prop currentContactUserIcon: Resource + @Consume('pageInfo') pageInfo: NavPathStack; + + build() { + NavDestination() { + Stack({ alignContent: Alignment.Top }) { + Column() { + Column() { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + StandardIcon({ icon: $r('app.media.ic_public_back') }) + .onClick(() => { + this.pageInfo.clear(); + + }) + } + } + .padding({ top: $r('app.float.back_icon_top'), left: $r('app.float.back_icon_left') }) + .alignItems(HorizontalAlign.Start) + .width(BaseConstants.FULL_WIDTH) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .backgroundColor($r('app.color.background_color_pink')) + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') + }) + + Image(this.currentContactUserIcon) + .height($r('app.float.contacts_detail_avatar_height')) + .margin({ top: $r('app.float.contacts_detail_avatar_top') }) + .zIndex(HomeConstants.CONTACTS_DETAIL_AVATAR_Z_INDEX) + .border({ + width: $r('app.float.contacts_detail_avatar_border_width'), + color: Color.White, + radius: $r('app.float.contacts_detail_avatar_border_radius') + }) + Column() { + Column() { + Column() { + Text(this.currentContactUserName || HomeConstants.CONTACTS_DEFAULT_SELECTED_NAME) + .fontSize(BaseConstants.FONT_SIZE_THIRTY_TWO) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .fontColor(Color.Black) + } + .width(BaseConstants.FULL_WIDTH) + .alignItems(HorizontalAlign.Center) + .padding({ top: $r('app.float.contacts_detail_user_top') }) + + Row() { + Column() { + Text(HomeConstants.USER_PHONE) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + } + .margin({ left: $r('app.float.phone_left') }) + + Blank() + StandardIcon({ icon: $r('app.media.ic_public_phone') }) + .margin({ right: $r('app.float.phone_icon_right') }) + StandardIcon({ icon: $r('app.media.ic_public_video') }) + .margin({ right: $r('app.float.phone_icon_right') }) + StandardIcon({ icon: $r('app.media.ic_public_comments') }) + .margin({ right: $r('app.float.phone_icon_right') }) + } + .width(BaseConstants.FULL_WIDTH) + .padding({ top: $r('app.float.phone_column_top') }) + + Column() { + Divider() + .color($r('app.color.line_color')) + .width(BaseConstants.FULL_WIDTH) + .margin({ left: $r('app.float.phone_divider_left'), right: $r('app.float.phone_divider_right') }) + } + .width(BaseConstants.FULL_WIDTH) + .padding({ top: $r('app.float.phone_divider_top') }) + + Column() { + Text(HomeConstants.LAST_POST) + .fontSize(BaseConstants.FONT_SIZE_TWELVE) + .fontColor(Color.Black) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + } + .width(BaseConstants.FULL_WIDTH) + .padding({ left: $r('app.float.last_post_left'), top: $r('app.float.last_post_top') }) + .alignItems(HorizontalAlign.Start) + + Column() { + List({ space: HomeConstants.IMAGES_SCOPE }) { + ForEach(SocialCirclePictures, (item: Resource) => { + ListItem() { + Image(item) + .width(Adaptive.ContactPhoneWidth(this.currentBreakpoint)) + .aspectRatio(HomeConstants.IMAGE_ASPECT_RATIO) + } + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .listDirection(Axis.Horizontal) + } + .padding({ left: $r('app.float.images_left'), top: $r('app.float.images_top') }) + } + .margin(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? {} : { + left: $r('app.float.images_column_left'), + right: $r('app.float.images_column_right') + }) + .height(Adaptive.ContactDetailHeight(this.currentBreakpoint)) + .borderRadius({ + topLeft: $r('app.float.contacts_detail_left'), + topRight: $r('app.float.contacts_detail_right') + }) + .backgroundColor(Color.White) + } + .margin({ top: $r('app.float.contacts_detail_column_top') }) + .width(BaseConstants.FULL_WIDTH) + .alignItems(HorizontalAlign.Start) + } + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsList.ets b/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsList.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddd67701debb01bfe024037863e3f6d4a7cb5812 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/pages/ContactsList.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Adaptive, BaseConstants, BreakpointConstants } from '@ohos/base'; +import { Alphabets, ContactsListData, ContactsDataInterface } from '../viewmodel/ConstactsViewModel'; +import { ContactsItem } from '../views/Contacts/ContactsItem'; +import { HomeConstants } from '../constants/HomeConstants'; +import { HomeTopSearch } from '../views/common/HomeTopSearch'; + +@Component +export struct ContactsList { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Link currentContactUserName: Resource; + @Link currentContactUserIcon: Resource; + @Link currentConversationUserName: string; + @Consume('pageInfo') pageInfo: NavPathStack; + @State selectedIndex: number = HomeConstants.CONTACTS_DEFAULT_SELECTED_INDEX; + @State private currentIndex: number = 0; + private listScroller: Scroller = new Scroller(); + + /** + * Find checked contact + */ + findContactsItemIndex(index: number): number { + if (index < 0) return 0; + const currentIndex = ContactsListData.findIndex(item => item.en_name[0].toUpperCase() === Alphabets[index]); + if (currentIndex === -1) { + return this.findContactsItemIndex(index - 1); + } else { + return currentIndex; + } + } + + build() { + Flex({ direction: FlexDirection.Column }) { + HomeTopSearch({ title: HomeConstants.CONTACTS_NAME }) + .height('13%') + Stack({ alignContent: Alignment.End }) { + List({ scroller: this.listScroller }) { + ListItem() { + ContactsItem({ name: HomeConstants.CONTACTS_LIST[0], icon: $r('app.media.ic_public_groups') }) + } + .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) + .backgroundColor(Color.White) + + ListItem() { + ContactsItem({ name: HomeConstants.CONTACTS_LIST[1], icon: $r('app.media.ic_public_names') }) + } + .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) + .backgroundColor(Color.White) + + ForEach(ContactsListData, (item: ContactsDataInterface, index: number) => { + ListItem() { + ContactsItem({ name: item.name, icon: item.icon }) + .onClick(() => { + if (this.pageInfo.size() > 1) { + this.pageInfo.pop(); + } + this.pageInfo.pushPath({ name: 'ContactsDetail' }); + this.currentContactUserName = item.name; + this.currentContactUserIcon = item.icon; + this.currentConversationUserName = ''; + this.currentIndex = index; + }) + .height(BaseConstants.FULL_HEIGHT) + .padding($r('app.float.contacts_item_padding')) + .backgroundColor(this.currentIndex === index ? $r('app.color.conversation_clicked_bg_color') : Color.White) + } + .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) + }, (item: ContactsDataInterface, index: number) => index + JSON.stringify(item)) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .onScrollIndex((firstIndex: number) => { + this.selectedIndex = firstIndex; + }) + + AlphabetIndexer({ arrayValue: Alphabets, selected: 0 }) + .onSelect((index: number) => { + const currentIndex = this.findContactsItemIndex(index); + this.listScroller.scrollToIndex(currentIndex + 2); + }) + .margin({ right: $r('app.float.alphabet_indexer_right') }) + .color(Color.Black) + .font({ + size: BaseConstants.FONT_SIZE_TWELVE, + weight: BaseConstants.FONT_WEIGHT_FIVE, + family: BaseConstants.FONT_FAMILY_MEDIUM + }) + } + } + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + } +} diff --git a/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationDetail.ets b/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cd1af1798c73fb7bd498184f0a30f41374849f6 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationDetail.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Adaptive, BaseConstants, BreakpointConstants } from '@ohos/base'; +import { ConversationDetailBottom } from '../views/Conversation/ConversationDetailBottom'; +import ConversationDetailItem from '../views/Conversation/ConversationDetailItem'; +import { ConversationDetailTopSearch } from '../views/Conversation/ConversationDetailTopSearch'; +import { HomeConstants } from '../constants/HomeConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; +// [Start conversation_detail] +@Component +export struct ConversationDetail { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Prop currentConversationUserName: string; + @Prop currentFeatureIndex: number; + @Consume('pageInfo') pageInfo: NavPathStack; + + build() { + NavDestination() { + Flex({ direction: FlexDirection.Column }) { + ConversationDetailTopSearch({ currentConversationUserName: $currentConversationUserName, }) + .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) + if (this.currentConversationUserName.length === HomeConstants.CONVERSATION_DEFAULT_SIZE) { + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_APPLET[0], + isAppletMsg: HomeConstants.IS_APPLET_CONVERSATION, + currentFeatureIndex: $currentFeatureIndex + }) + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_APPLET[1], + currentFeatureIndex: $currentFeatureIndex + }) + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: !HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_APPLET[2], + currentFeatureIndex: $currentFeatureIndex + }) + } else { + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_DOCUMENT[0], + isDocumentMsg: HomeConstants.IS_DOCUMENT_CONVERSATION, + currentFeatureIndex: $currentFeatureIndex + }) + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_DOCUMENT[1], + currentFeatureIndex: $currentFeatureIndex + }) + ConversationDetailItem({ + receivedName: $currentConversationUserName, + isReceived: !HomeConstants.IS_RECEIVED, + content: HomeConstants.CONVERSATION_LIST_DOCUMENT[2], + currentFeatureIndex: $currentFeatureIndex + }) + } + Blank() + ConversationDetailBottom() + } + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + .backgroundColor($r('app.color.background_color_grey')) + .padding({ + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } + .hideTitleBar(true) + } +} +// [End conversation_detail] \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationList.ets b/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationList.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f174f8395d94f017d4910b95a6d61f1d91010ff --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/pages/ConversationList.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Adaptive, BaseConstants, BreakpointConstants } from '@ohos/base'; +import { ConversationDataInterface, ConversationListData } from '../viewmodel/ConversationViewModel'; +import { ConversationItem } from '../views/Conversation/ConversationItem'; +import { HomeTopSearch } from '../views/common/HomeTopSearch'; +import { HomeConstants } from '../constants/HomeConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; +// [Start conversation_list_diff_device] +@Component +export struct ConversationList { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Link currentConversationUserName: Resource; + @Link currentContactUserName: string; + @State private currentIndex: number = 0; + @Consume('pageInfo') pageInfo: NavPathStack; + + build() { + Flex({ direction: FlexDirection.Column }) { + HomeTopSearch({ title: HomeConstants.CONVERSATION_TITLE }) + .height('13%') + // [Start conversation_list] + List() { + ForEach(ConversationListData, (item: ConversationDataInterface, index: number) => { + ListItem() { + ConversationItem(item) + .onClick(() => { + if (this.pageInfo.size() > 1) { + this.pageInfo.pop(); + } + this.pageInfo.pushPath({ name: 'ConversationDetail' }); + this.currentConversationUserName = item.name; + this.currentContactUserName = ''; + this.currentIndex = index; + }) + .backgroundColor(this.currentIndex === index ? $r('app.color.conversation_clicked_bg_color') : Color.White) + } + .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) + + }, (item: ConversationDataInterface, index: number) => index + JSON.stringify(item)) + } + // [End conversation_list] + .padding({ + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 && + this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + .backgroundColor(Color.White) + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + } + + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + } +} +// [End conversation_list_diff_device] \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/pages/Index.ets b/MultiDeviceCommunication/features/home/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..94cbb94629b2c89070b077d7ee9acd715cf40432 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/pages/Index.ets @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Adaptive, BaseConstants, BreakpointConstants, CurrentFeature, CurrentPage } from '@ohos/base'; +import ConversationDetailNone from '../views/Conversation/ConversationDetailNone'; +import { ContactsDetail } from './ContactsDetail'; +import { ContactsList } from './ContactsList'; +import { ConversationDetail } from './ConversationDetail'; +import { ConversationList } from './ConversationList'; +import { HomeConstants } from '../constants/HomeConstants'; +import { HomeTab } from '../views/HomeTab'; +import { SocialCircle } from '@ohos/SocialCircle'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Entry +@Component +export struct Index { + @StorageProp('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + // [Start navigation_diff_device] + @Provide('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + // [StartExclude navigation_diff_device] + @State currentConversationUserName: string = ''; + @State currentContactUserName: string = ''; + @State currentContactUserIcon: Resource = HomeConstants.DEFAULT_AVATAR; + @State currentPageIndex: number = CurrentPage.HOME; + @State currentFeatureIndex: Number = CurrentFeature.HOME; + @State isSplitAppletScreen: boolean = BaseConstants.SPLIT_APPLET_SCREEN; + @State isSplitDocumentScreen: boolean = BaseConstants.SPLIT_DOCUMENT_SCREEN; + + watchCurrentBreakpoint() { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM && + this.pageInfo.getParamByName('ConversationDetailNone').length === 1 && this.pageInfo.size() === 1) { + this.pageInfo.pop(); + } + } + // [EndExclude navigation_diff_device] + @Builder + PageMap(name: string) { + if (name === 'ConversationDetail') { + ConversationDetail({ currentConversationUserName: this.currentConversationUserName, currentFeatureIndex: 1 }); + } else if (name === 'ConversationDetailNone') { + ConversationDetailNone(); + } else if (name === 'ContactsDetail') { + ContactsDetail({ + currentContactUserName: this.currentContactUserName, + currentContactUserIcon: this.currentContactUserIcon + }); + } else { + ConversationDetailNone(); + } + } + + build() { + Column() { + /** + * Home and contacts page + */ + Flex() { + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .backgroundColor($r('app.color.background_color_grey_two')) + .padding({ + top: $r('app.float.home_tab_padding_top'), + bottom: $r('app.float.home_tab_padding_bottom'), + left: $r('app.float.home_tab_padding_left') + }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + // [Start nav_path_stack] + Navigation(this.pageInfo) { + if (this.currentPageIndex === 0) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) { + ConversationList({ + currentConversationUserName: $currentConversationUserName, + currentContactUserName: $currentContactUserName + }) + .flexGrow(BaseConstants.FLEX_GROW_ONE) + .width(BaseConstants.FULL_WIDTH) + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) + .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + } + .padding({ + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 + && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + .height(BaseConstants.FULL_HEIGHT) + + } else if (this.currentPageIndex === 1) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) { + ContactsList({ + currentContactUserName: $currentContactUserName, + currentConversationUserName: $currentConversationUserName, + currentContactUserIcon: $currentContactUserIcon + }) + .flexGrow(BaseConstants.FLEX_GROW_ONE) + .width(BaseConstants.FULL_WIDTH) + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) + .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + } + .height(BaseConstants.FULL_HEIGHT) + .padding({ + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 + && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } + } + // [End nav_path_stack] + .hideTitleBar(true) + .hideToolBar(true) + .navBarWidth(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? HomeConstants.NAVIGATION_NAV_BAR_WIDTH_LG : + HomeConstants.NAVIGATION_NAV_BAR_WIDTH_MD) + .navDestination(this.PageMap) + .mode(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? NavigationMode.Stack : NavigationMode.Split) + .width(BaseConstants.FULL_WIDTH) + } + .visibility(this.currentPageIndex === CurrentPage.HOME || this.currentPageIndex === CurrentPage.CONVERSATION ? + Visibility.Visible : Visibility.None) + // [End navigation_diff_device] + /** + * SocialCircle page + */ + Flex({ direction: FlexDirection.Column }) { + SocialCircle() + .flexGrow(BaseConstants.FLEX_GROW_ONE) + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .visibility(this.currentPageIndex === CurrentPage.SOCIAL_CIRCLE && this.currentBreakpoint !== + BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + .padding({ + bottom: $r('app.float.tab_content_pb') + }) + + + Row() { + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .backgroundColor($r('app.color.background_color_grey_two')) + .padding({ + top: $r('app.float.home_tab_padding_top'), + bottom: $r('app.float.home_tab_padding_bottom'), + left: $r('app.float.home_tab_padding_left') + }) + SocialCircle() + .width(BaseConstants.NINETY_WIDTH_PERCENT) + } + .width(BaseConstants.FULL_WIDTH) + .visibility(this.currentPageIndex === CurrentPage.SOCIAL_CIRCLE && this.currentBreakpoint === + BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + + /** + * Me page + */ + Flex({ direction: FlexDirection.Column }) { + Column() + .flexGrow(BaseConstants.FLEX_GROW_ONE) + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .visibility(this.currentPageIndex === CurrentPage.ME && this.currentBreakpoint !== + BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 + && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + + + Row() { + HomeTab({ currentPageIndex: $currentPageIndex }) + .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) + .backgroundColor($r('app.color.background_color_grey_two')) + .padding({ + top: $r('app.float.home_tab_padding_top'), + bottom: $r('app.float.home_tab_padding_bottom'), + left: $r('app.float.home_tab_padding_left') + }) + Column() + .width(BaseConstants.NINETY_WIDTH_PERCENT) + .height(BaseConstants.FULL_HEIGHT) + } + .width(BaseConstants.FULL_WIDTH) + .visibility(this.currentPageIndex === CurrentPage.ME && this.currentBreakpoint === + BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + } + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + .backgroundColor($r('app.color.background_color_grey_two')) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/BottomTabViewModel.ets b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/BottomTabViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..33f285bac0e0c7404a229054f678cd46c08f7c7c --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/BottomTabViewModel.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TabInfoModel } from '@ohos/base'; + +const ButtonInfo: TabInfoModel[] = [ + { + index: 0, + img: $r('app.media.icon_message'), + selectImg: $r('app.media.icon_message_selected'), + title: $r('app.string.Message') + }, + { + index: 1, + img: $r('app.media.icon_contacts'), + selectImg: $r('app.media.icon_contacts_selected'), + title: $r('app.string.Contacts') + }, + { + index: 2, + img: $r("app.media.icon_social_circle"), + selectImg: $r("app.media.icon_social_circle_selected"), + title: $r('app.string.SocialCircle') + }, + { + index: 3, + img: $r('app.media.icon_me'), + selectImg: $r('app.media.icon_me'), + title: $r('app.string.Me') + } +]; + +export { ButtonInfo }; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConstactsViewModel.ets b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConstactsViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..6425d33341d30e19f49116c3423fe743b2b7cb23 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConstactsViewModel.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 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. + */ + +interface ContactsDataInterface { + name: Resource; + en_name: string; + icon: Resource; +} + +const ContactsListData: ContactsDataInterface[] = [ + { name: $r('app.string.Alan'), en_name: '#Alan', icon: $r('app.media.avatar1') }, + { name: $r('app.string.AQin'), en_name: 'AQin', icon: $r('app.media.avatar1') }, + { name: $r('app.string.CaiLan'), en_name: 'CaiLan', icon: $r('app.media.avatar2') }, + { name: $r('app.string.Deng'), en_name: 'Deng', icon: $r('app.media.avatar3') }, + { name: $r('app.string.excel'), en_name: 'excel', icon: $r('app.media.avatar2') }, + { name: $r('app.string.FanYi'), en_name: 'FanYi', icon: $r('app.media.avatar2') }, + { name: $r('app.string.FenFen'), en_name: 'FenFen', icon: $r('app.media.avatar2') }, + { name: $r('app.string.ge'), en_name: 'ge', icon: $r('app.media.avatar4') }, + { name: $r('app.string.ge'), en_name: 'Idea', icon: $r('app.media.avatar4') }, + { name: $r('app.string.FenFen'), en_name: 'jack', icon: $r('app.media.avatar1') }, + { name: $r('app.string.CaiLan'), en_name: 'kat', icon: $r('app.media.avatar1') }, + { name: $r('app.string.LiX'), en_name: 'lily', icon: $r('app.media.avatar11') }, + { name: $r('app.string.LiX'), en_name: 'LiX', icon: $r('app.media.avatar8') }, + { name: $r('app.string.Ma'), en_name: 'Ma', icon: $r('app.media.avatar11') }, + { name: $r('app.string.Ma'), en_name: 'nie', icon: $r('app.media.avatar5') }, + { name: $r('app.string.FanYi'), en_name: 'tom', icon: $r('app.media.avatar10') }, + { name: $r('app.string.Deng'), en_name: 'Zhang', icon: $r('app.media.avatar6') }, + { name: $r('app.string.CaiLan'), en_name: 'Wang', icon: $r('app.media.avatar7') }, + { name: $r('app.string.CaiLan'), en_name: 'Zo', icon: $r('app.media.avatar9') }, +]; + +const Alphabets: string[] = ['#', '☆', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; + +export { ContactsDataInterface, ContactsListData, Alphabets }; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConversationViewModel.ets b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConversationViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..687cb7f78f7bd4007ae483cc2ad717ae7f6f520a --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/ConversationViewModel.ets @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Want, common } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { Logger } from '@ohos/base'; + +interface ConversationDataInterface { + name: Resource + msg: Resource + time: ResourceStr + icon: Resource +}; + +const ConversationListData: ConversationDataInterface[] = [ + { name: $r('app.string.Alan'), msg: $r('app.string.okay'), time: '13:55', icon: $r('app.media.avatar1') }, + { name: $r('app.string.CaiLan'), msg: $r('app.string.okay'), time: '13:55', icon: $r('app.media.avatar2') }, + { name: $r('app.string.FenFen'), msg: $r('app.string.okay'), time: '12:00', icon: $r('app.media.avatar11') }, + { name: $r('app.string.FenFen'), msg: $r('app.string.okay'), time: '08:00', icon: $r('app.media.avatar4') }, + { name: $r('app.string.FanYi'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar5') }, + { name: $r('app.string.Deng'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar6') }, + { name: $r('app.string.CaiLan'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar7') }, + { name: $r('app.string.Alan'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar8') }, + { name: $r('app.string.Alan'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar9') }, + { name: $r('app.string.FanYi'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar10') }, + { name: $r('app.string.Deng'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar11') }, + { name: $r('app.string.ge'), msg: $r('app.string.okay'), time: $r('app.string.yesterday'), icon: $r('app.media.avatar1') }, +]; + +class ConversationViewModel { + public startAppletAbility(context: common.UIAbilityContext, index: number): void { + const want: Want = { + bundleName: getContext(context).applicationInfo.name, + abilityName: 'AppletAbility', + parameters: { + position: index + } + }; + try { + context.startAbility(want, (err: BusinessError) => { + if (err.code) { + Logger.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + } + }); + } catch (error) { + hilog.error(0x00004, 'ConversationViewModel', '%{public}s', error); + } + } + + public startDocumentAbility(context: common.UIAbilityContext, index: number): void { + const want: Want = { + bundleName: getContext(context).applicationInfo.name, + abilityName: 'DocumentAbility', + parameters: { + position: index + } + }; + try { + context.startAbility(want, (err: BusinessError) => { + if (err.code) { + Logger.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + } + }); + } catch (error) { + Logger.error(`startAbility failed, message is ${error}`); + } + } +} + +export { ConversationDataInterface, ConversationListData, ConversationViewModel }; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/SocialCircleViewModel.ets b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/SocialCircleViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..a66859ca05d0c722ec25730881fb3a986081091d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/viewmodel/SocialCircleViewModel.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 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. + */ + +const SocialCirclePictures: Resource[] = [ + $r('app.media.social_circle1'), + $r('app.media.social_circle2'), + $r('app.media.social_circle3'), + $r('app.media.social_circle4'), + $r('app.media.social_circle5'), + $r('app.media.social_circle6'), + $r('app.media.social_circle7'), + $r('app.media.social_circle8'), + $r('app.media.social_circle9'), +]; + +export { SocialCirclePictures }; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Contacts/ContactsItem.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Contacts/ContactsItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ed4f15fb623118249eab221983200b44a7d6620 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Contacts/ContactsItem.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/base'; + +@Component +export struct ContactsItem { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + private name?: Resource; + private icon?: Resource; + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Image(this.icon) + .height($r('app.float.avatar_image_size')) + .width($r('app.float.avatar_image_size')) + } + .width($r('app.float.avatar_image_size')) + .margin({ left: $r('app.float.icon_margin_two'), right: $r('app.float.icon_margin_one') }) + + Column() { + Text(this.name) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .lineHeight($r('app.float.text_line_height_two')) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + } + .flexShrink(BaseConstants.FLEX_SHRINK_ONE) + .margin({ left: $r('app.float.icon_margin_one') }) + + Blank() + } + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailBottom.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailBottom.ets new file mode 100644 index 0000000000000000000000000000000000000000..615c172d1bc92435841d47117844977da3d52a8a --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailBottom.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants } from '@ohos/base/src/main/ets/constants/BaseConstants'; +import { StandardIcon } from '@ohos/base/src/main/ets/views/image/StandardIcon'; +import { HomeConstants } from '../../constants/HomeConstants'; + +@Component +export struct ConversationDetailBottom { + @Builder CustomKeyboardBuilder(){} + build() { + Flex({ alignItems: ItemAlign.Center }) { + Column() { + StandardIcon({ icon: $r('app.media.ic_public_emoji') }) + } + .flexBasis(HomeConstants.FLEX_BASIS_AUTO) + .padding({ + right: $r('app.float.conversation_detail_bottom_padding'), + left: $r('app.float.conversation_detail_bottom_padding'), + }) + + Blank() + Column() { + TextArea() + .placeholderColor($r('app.color.text_input_default_color')) + .caretColor($r('app.color.text_input_default_care_color')) + .backgroundColor($r('app.color.text_input_default_background_color')) + .borderRadius(HomeConstants.CONVERSATION_DETAIL_BOTTOM_TEXT_RADIUS) + .flexGrow(BaseConstants.FLEX_GROW_ONE) + .padding({ right: $r('app.float.conversation_detail_bottom_text_padding') }) + .backgroundColor(Color.White) + .enableKeyboardOnFocus(false) + .customKeyboard(this.CustomKeyboardBuilder()) + } + + Column() { + StandardIcon({ icon: $r('app.media.ic_public_add_norm') }) + } + .padding({ + right: $r('app.float.conversation_detail_bottom_padding'), + left: $r('app.float.conversation_detail_bottom_padding'), + }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.conversation_detail_bottom_height')) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailItem.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f78a11ff3e63d71c74e4dffc8734d4499cb000d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailItem.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../../constants/HomeConstants'; +import { MessageBubble } from '../MessageBubble'; + +@Component +export default struct ConversationDetailItem { + @Link currentFeatureIndex: number; + @Link receivedName: string; + private isReceived: boolean = !HomeConstants.IS_RECEIVED; + private content: ResourceStr = ''; + private isAppletMsg?: boolean; + private isDocumentMsg?: boolean; + + build() { + Flex({ justifyContent: FlexAlign.End, alignItems: ItemAlign.End }) { + MessageBubble({ + receivedName: $receivedName, + currentFeatureIndex: $currentFeatureIndex, + isReceived: this.isReceived, + content: this.content, + isAppletMsg: this.isAppletMsg, + isDocumentMsg: this.isDocumentMsg + }) + } + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailNone.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailNone.ets new file mode 100644 index 0000000000000000000000000000000000000000..1028d08c19940a0e6181f51c5e5ab02a1d46393f --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailNone.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants } from '@ohos/base/src/main/ets/constants/BaseConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Component +export default struct ConversationDetailNone { + build() { + NavDestination() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.ic_none_message')) + .width($r('app.float.conversation_none_icon_width')) + .height($r('app.float.conversation_none_icon_height')) + } + .backgroundColor($r('app.color.conversation_none_icon_bg_color')) + .height(BaseConstants.FULL_HEIGHT) + } + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') + }) + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailTopSearch.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailTopSearch.ets new file mode 100644 index 0000000000000000000000000000000000000000..f847d4741ef3804db63211704ffb93a149bc344c --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationDetailTopSearch.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants, StandardIcon } from '@ohos/base'; +import { HomeConstants } from '../../constants/HomeConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Component +export struct ConversationDetailTopSearch { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Link currentConversationUserName: string; + @Consume('pageInfo') pageInfo: NavPathStack; + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + StandardIcon({ icon: $r('app.media.ic_public_back') }) + .onClick(() => { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + this.pageInfo.clear(); + } else if (this.pageInfo.size() === 1) { + this.pageInfo.clear(); + this.pageInfo.pushPath({ name: 'ConversationDetailNone' }); + } else { + this.pageInfo.clear(); + this.pageInfo.pushPath({ name: 'ConversationDetailNone' }); + } + }) + Text(this.currentConversationUserName || HomeConstants.CONVERSATION_DETAIL_TOP_TITLE) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .fontSize(BaseConstants.FONT_SIZE_EIGHTEEN) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontColor($r('app.color.conversation_default_text_color')) + StandardIcon({ icon: $r('app.media.ic_public_more') }) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .padding({ left: $r('app.float.icon_margin_two'), right: $r('app.float.icon_margin_two'),top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') }) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationItem.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..93752683102512ff26333794f3ce4c246478e029 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/Conversation/ConversationItem.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/base'; +import { HomeConstants } from '../../constants/HomeConstants'; + +@Component +export struct ConversationItem { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + private name?: Resource; + private msg?: Resource; + private time?: ResourceStr; + private icon?: Resource; + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Image(this.icon) + .height($r('app.float.avatar_image_size')) + .width($r('app.float.avatar_image_size')) + } + .width($r('app.float.avatar_image_size')) + .margin({ left: $r('app.float.icon_margin_two'), right: $r('app.float.icon_margin_one') }) + + Flex({ direction: FlexDirection.Column,justifyContent:FlexAlign.Center }) { + Text(this.name) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .lineHeight($r('app.float.text_line_height_two')) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + Text(this.msg) + .maxLines(HomeConstants.CONVERSATION_DETAIL_MAX_LINE) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .lineHeight($r('app.float.text_line_height_one')) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontColor(Color.Grey) + .width(BaseConstants.FULL_WIDTH) + } + .flexShrink(BaseConstants.FLEX_SHRINK_ONE) + .margin({ left: $r('app.float.icon_margin_one') }) + + Blank() + Column() { + Text(this.time) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor(Color.Grey) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .width($r('app.float.conversation_list_time_width')) + } + .flexBasis(HomeConstants.FLEX_BASIS_AUTO) + .margin({ left: $r('app.float.icon_margin_two'), right: $r('app.float.icon_margin_one') }) + } + .width(BaseConstants.FULL_WIDTH) + .padding($r('app.float.conversation_list_time_padding')) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/HomeTab.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/HomeTab.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea9db717a3673ea4f54b35846ff205820afc86cd --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/HomeTab.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/base'; +import { ButtonInfo } from '../viewmodel/BottomTabViewModel'; +import { TabInfoModel } from '@ohos/base'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct HomeTab { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Link currentPageIndex: number; + + build() { + Column() { + Tabs({ + barPosition: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() + .tabBar(this.BottomNavigation(ButtonInfo[HomeConstants.TAB_MESSAGE_INDEX])) + TabContent() + .tabBar(this.BottomNavigation(ButtonInfo[HomeConstants.TAB_CONTACTS_INDEX])) + TabContent() + .tabBar(this.BottomNavigation(ButtonInfo[HomeConstants.TAB_SOCIAL_CIRCLE_INDEX])) + TabContent() + .tabBar(this.BottomNavigation(ButtonInfo[HomeConstants.TAB_ME_INDEX])) + } + .vertical(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) + .height(BaseConstants.FULL_HEIGHT) + .margin({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? '' : $r('app.float.home_tab_top_lg'), + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? '' : $r('app.float.home_tab_bottom_lg') + }) + } + .backgroundColor($r('app.color.background_color_grey_two')) + .expandSafeArea([], [SafeAreaEdge.BOTTOM]) + } + + @Builder + BottomNavigation(button: TabInfoModel) { + Column() { + Image(this.currentPageIndex === button.index ? button.selectImg : button.img) + .objectFit(ImageFit.Contain) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.main_image_size_lg') : $r('app.float.main_image_size')) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.main_image_size_lg') : $r('app.float.main_image_size')) + Text(button.title) + .fontColor(this.currentPageIndex === button.index ? $r('app.color.focus_color') : Color.Black) + .opacity(this.currentPageIndex === button.index ? BaseConstants.FULL_OPACITY : BaseConstants.SIXTY_OPACITY) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .textAlign(TextAlign.Center) + .fontSize($r('app.float.micro_font_size')) + .lineHeight($r('app.float.text_line_height_three')) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .margin({ top: $r('app.float.document_text_top') }) + } + + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + .onClick(() => { + this.currentPageIndex = button.index; + }) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/MessageBubble.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/MessageBubble.ets new file mode 100644 index 0000000000000000000000000000000000000000..0bdb2404d60bc82588e1e1b08e10c9663336a47b --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/MessageBubble.ets @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants, IntroduceText, NormalText } from '@ohos/base' +import { HomeConstants } from '../constants/HomeConstants'; +import { ConversationDataInterface, ConversationListData } from '../viewmodel/ConversationViewModel'; + +@Component +export struct MessageBubble { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Link receivedName: Resource; + @Link currentFeatureIndex: number; + private isReceived: boolean = !HomeConstants.IS_RECEIVED; + private content: ResourceStr = ""; + private isAppletMsg?: boolean; + private isDocumentMsg?: boolean; + avatar1: Resource = $r('app.media.avatar1'); + avatar2: Resource = $r('app.media.avatar7'); + + build() { + Column() { + Flex({ justifyContent: this.isReceived ? FlexAlign.Start : FlexAlign.End, direction: FlexDirection.Row }) { + if (this.isReceived) { + Image(ConversationListData.find((item) => item.name === this.receivedName)?.icon || this.avatar1) + .width($r('app.float.avatar_image_size')) + .height($r('app.float.avatar_image_size')) + .flexShrink(BaseConstants.FLEX_SHRINK_ZERO) + } + Column() { + Stack({ alignContent: this.isReceived ? Alignment.TopStart : Alignment.TopEnd }) { + Path() + .commands('M-10 1 L0 18 L32 1 Z') + .fillOpacity(HomeConstants.CONVERSATION_DETAIL_FILL_OPACITY) + .stroke(Color.White) + .strokeWidth(HomeConstants.CONVERSATION_DETAIL_STROKE_WIDTH) + .fill(Color.White) + .visibility(this.isReceived ? Visibility.Visible : Visibility.None) + Path() + .commands('M23 1 L0 28 L-10 1 Z') + .fillOpacity(HomeConstants.CONVERSATION_DETAIL_FILL_OPACITY) + .stroke(Color.White) + .strokeWidth(HomeConstants.CONVERSATION_DETAIL_STROKE_WIDTH) + .fill(Color.White) + .visibility(this.isReceived ? Visibility.None : Visibility.Visible) + .zIndex(HomeConstants.CONTACTS_DETAIL_AVATAR_Z_INDEX) + .margin({ right: $r('app.float.conversation_detail_path_right') }) + Column() { + this.MessageContent() + } + .padding({ + left: $r('app.float.path_column_left'), + right: $r('app.float.path_column_right'), + top: $r('app.float.path_column_top'), + bottom: $r('app.float.path_column_bottom') + }) + .backgroundColor(Color.White) + .borderRadius(HomeConstants.PATH_BORDER_RADIUS) + } + .padding({ + top: $r('app.float.path_top'), + left: $r('app.float.path_left'), + right: $r('app.float.path_right'), + bottom: $r('app.float.path_bottom') + }) + .width(BaseConstants.FULL_WIDTH) + } + .width(BaseConstants.FULL_WIDTH) + + if (!this.isReceived) { + Image(this.avatar2) + .width($r('app.float.icon_width')) + .height($r('app.float.icon_height')) + .flexShrink(BaseConstants.FLEX_SHRINK_ZERO) + } + } + } + .margin({ left: $r('app.float.message_bubble_left'), right: $r('app.float.message_bubble_right') }) + } + + @Builder + MessageContent() { + if (this.isAppletMsg) { + Column() { + Row() { + Image($r('app.media.ic_tea')) + .height($r('app.float.applet_icon_size')) + .width($r('app.float.applet_icon_size')) + .margin({ right: $r('app.float.applet_icon_right') }) + Text(HomeConstants.APPLET_TITLE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TWELVE) + .fontColor($r('app.color.conversation_default_text_color')) + .textAlign(TextAlign.Start) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + } + .margin({ bottom: $r('app.float.applet_title_bottom') }) + + Text(this.content) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TWELVE) + .fontColor($r('app.color.conversation_default_text_color')) + .textAlign(TextAlign.Start) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .margin({ bottom: $r('app.float.applet_introduce_bottom') }) + .copyOption(CopyOptions.LocalDevice) + Flex() { + } + .height($r('app.float.applet_image_height')) + .width($r('app.float.applet_image_width')) + .backgroundImage($r('app.media.picture_applet_link')) + .backgroundImageSize({ width: $r('app.float.applet_image_width'), height: $r('app.float.applet_image_height') }) + .constraintSize({ maxWidth: BaseConstants.FULL_WIDTH }) + .margin({ bottom: $r('app.float.applet_image_bottom') }) + + Text(HomeConstants.APPLET_DESCRIBE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor($r('app.color.background_color_grey_three')) + .textAlign(TextAlign.Start) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + } + .alignItems(HorizontalAlign.Start) + } else if (this.isDocumentMsg) { + Column() { + Row() { + NormalText({ data: this.content }) + .margin({ right: $r('app.float.applet_icon_right') }) + .width($r('app.float.document_text_width')) + Image($r('app.media.ic_PDF')) + .height($r('app.float.document_icon_size')) + .width($r('app.float.document_icon_size')) + .margin({ right: $r('app.float.document_icon_right') }) + } + .margin({ bottom: $r('app.float.document_icon_bottom') }) + + IntroduceText({ data: HomeConstants.DOCUMENT_SIZE, fontColor: $r('app.color.background_color_grey_three') }) + .margin({ bottom: $r('app.float.document_text_bottom') }) + Divider() + .color($r('app.color.divider_background_color')) + .strokeWidth(HomeConstants.DOCUMENT_DIVIDER_WIDTH).margin({ bottom: $r('app.float.divider_bottom') }) + Row() { + Image($r('app.media.ic_file')) + .width($r('app.float.document_small_icon_size')) + .height($r('app.float.document_small_icon_size')) + .margin({ right: $r('app.float.document_small_icon_right') }) + IntroduceText({ + data: HomeConstants.DOCUMENT_INTRODUCE, + fontColor: $r('app.color.background_color_grey_three') + }) + .margin({ top: $r('app.float.document_introduce_top') }) + } + } + .alignItems(HorizontalAlign.Start) + .width($r('app.float.document_width')) + .margin({ bottom: $r('app.float.document_bottom') }) + } else { + Text(this.content) + .fontSize(BaseConstants.FONT_SIZE_TWELVE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .lineHeight($r('app.float.conversation_default_text_line')) + .fontColor($r('app.color.conversation_default_text_color')) + .copyOption(CopyOptions.LocalDevice) + } + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/ets/views/common/HomeTopSearch.ets b/MultiDeviceCommunication/features/home/src/main/ets/views/common/HomeTopSearch.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e010ac7a64ade89c0afa75463458337b7c39e5f --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/ets/views/common/HomeTopSearch.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants, StandardIcon } from '@ohos/base'; +import { HomeConstants } from '../../constants/HomeConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Component +export struct HomeTopSearch { + @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @Prop title: Resource; + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Text(this.title) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .fontSize(BaseConstants.FONT_SIZE_TWENTY_FOUR) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .width(BaseConstants.FULL_WIDTH) + } + .flexBasis(HomeConstants.SEARCH_TEXT_FLEX_BASIS) + + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + Column() { + this.searchBar() + } + .flexBasis(HomeConstants.FLEX_BASIS_AUTO) + .margin({ right: $r('app.float.icon_margin_two') }) + } else { + Blank() + StandardIcon({ icon: $r('app.media.ic_public_search') }) + .margin({ right: $r('app.float.phone_icon_right') }) + } + Column() { + StandardIcon({ icon: $r('app.media.ic_public_add_norm') }) + .flexBasis(HomeConstants.FLEX_BASIS_AUTO) + } + .margin({ right: $r('app.float.phone_icon_right') }) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + .backgroundColor(Color.White) + .padding({ left: $r('app.float.phone_icon_left'),top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') }) + } + + @Builder + searchBar() { + Row() { + Stack({ alignContent: Alignment.Start }) { + TextInput({ placeholder: HomeConstants.SEARCH_TEXT_INPUT }) + .placeholderFont({ + size: $r('app.float.text_input_default_font'), + weight: FontWeight.Normal + }) + .placeholderColor($r('app.color.text_input_default_color')) + .height($r('app.float.text_input_height')) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .padding({ + left: $r('app.float.text_input_left'), + right: $r('app.float.text_input_right') + }) + .width(BaseConstants.FULL_WIDTH) + .enableKeyboardOnFocus(HomeConstants.ENABLE_KEY_BOARD_ON_FOCUS) + .backgroundColor($r('app.color.text_input_default_background_color')) + .caretColor($r('app.color.text_input_default_care_color')) + + Image($r('app.media.ic_public_search')) + .width($r('app.float.small_icon_width')) + .height($r('app.float.small_icon_height')) + .margin({ left: $r('app.float.add_icon_left') }) + } + .alignSelf(ItemAlign.Center) + .layoutWeight(BaseConstants.LAYOUT_WEIGHT_ONE) + } + .justifyContent(FlexAlign.Center) + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/module.json5 b/MultiDeviceCommunication/features/home/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a40a436c346c4b3523266ab801e76f4d38bcec0 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "home", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/element/color.json b/MultiDeviceCommunication/features/home/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..0599ab4cdb3a803b642b7becfcd7c9e712e537d0 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/element/color.json @@ -0,0 +1,80 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "focus_color", + "value": "#0A59F7" + }, + { + "name": "background_color_grey", + "value": "#F6F6F6" + }, + { + "name": "background_color_grey_two", + "value": "#F1F3F5" + }, + { + "name": "background_color_grey_three", + "value": "#8A9097" + }, + { + "name": "divider_background_color", + "value": "#E6E6E6" + }, + { + "name": "background_color_pink", + "value": "#FCF7F6" + }, + { + "name": "background_color_icon", + "value": "#F0A6C3" + }, + { + "name": "font_color_one", + "value": "#000000" + }, + { + "name": "font_color_black_two", + "value": "#182431" + }, + { + "name": "line_color", + "value": "#E7E7E7" + }, + { + "name": "tab_clicked_color", + "value": "#1698CE" + }, + { + "name": "tab_unclicked_color", + "value": "#6B6B6B" + }, + { + "name": "text_input_default_color", + "value": "#99000000" + }, + { + "name": "text_input_default_background_color", + "value": "#F1F3F5" + }, + { + "name": "text_input_default_care_color", + "value": "#007DFF" + }, + { + "name": "conversation_none_icon_bg_color", + "value": "#F6F6F6" + }, + { + "name": "conversation_default_text_color", + "value": "#182431" + }, + { + "name": "conversation_clicked_bg_color", + "value": "#33D8D8D8" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/element/float.json b/MultiDeviceCommunication/features/home/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..0b7018b2b11e87b38ea6075c20317bf63902efb1 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/element/float.json @@ -0,0 +1,488 @@ +{ + "float": [ + { + "name": "micro_font_size", + "value": "10fp" + }, + { + "name": "icon_height_one", + "value": "24vp" + }, + { + "name": "icon_width_one", + "value": "24vp" + }, + { + "name": "icon_margin_one", + "value": "12vp" + }, + { + "name": "icon_margin_two", + "value": "24vp" + }, + { + "name": "main_image_size", + "value": "22vp" + }, + { + "name": "main_image_size_lg", + "value": "24vp" + }, + { + "name": "avatar_image_size", + "value": "40vp" + }, + { + "name": "bar_width", + "value": "96vp" + }, + { + "name": "text_line_height_one", + "value": "19fp" + }, + { + "name": "text_line_height_three", + "value": "14fp" + }, + { + "name": "text_line_height_two", + "value": "22fp" + }, + { + "name": "background_color_grey", + "value": "#111111" + }, + { + "name": "input_radius_one", + "value": "20vp" + }, + { + "name": "text_line_height_five", + "value": "21fp" + }, + { + "name": "smaller_mini_font_size", + "value": "11fp" + }, + { + "name": "picture_gap", + "value": "2vp" + }, + { + "name": "home_tab_width", + "value": "96vp" + }, + { + "name": "home_tab_height", + "value": "56vp" + }, + { + "name": "home_tab_padding_left", + "value": "22vp" + }, + { + "name": "home_tab_padding_top", + "value": "180vp" + }, + { + "name": "home_tab_padding_bottom", + "value": "180vp" + }, + { + "name": "home_list_width", + "value": "22vp" + }, + { + "name": "home_tab_font_size", + "value": "20fp" + }, + { + "name": "font_family_normal", + "value": "HarmonyHeiTi" + }, + { + "name": "font_family_medium", + "value": "HarmonyHeiTi-Medium" + }, + { + "name": "font_family_bold", + "value": "HarmonyHeiTi-Bold" + }, + { + "name": "font_family_semi_bold", + "value": "HarmonyHeiTi-SemiBold" + }, + { + "name": "font_size_ten", + "value": "10fp" + }, + { + "name": "font_size_eleven", + "value": "11fp" + }, + { + "name": "font_size_twelve", + "value": "12fp" + }, + { + "name": "font_size_fourteen", + "value": "14fp" + }, + { + "name": "font_size_sixteen", + "value": "16fp" + }, + { + "name": "font_size_eighteen", + "value": "18fp" + }, + { + "name": "font_size_twenty", + "value": "20fp" + }, + { + "name": "font_size_twenty_four", + "value": "24fp" + }, + { + "name": "font_size_thirty_two", + "value": "32fp" + }, + { + "name": "icon_height", + "value": "40vp" + }, + { + "name": "icon_width", + "value": "40vp" + }, + { + "name": "icon_right", + "value": "8vp" + }, + { + "name": "user_name_bottom", + "value": "6vp" + }, + { + "name": "user_message_bottom", + "value": "8vp" + }, + { + "name": "header_top", + "value": "16vp" + }, + { + "name": "header_right", + "value": "20vp" + }, + { + "name": "header_bottom", + "value": "16vp" + }, + { + "name": "header_left", + "value": "24vp" + }, + { + "name": "back_icon_top", + "value": "19vp" + }, + { + "name": "back_icon_left", + "value": "26vp" + }, + { + "name": "contacts_detail_avatar_height", + "value": "124vp" + }, + { + "name": "contacts_detail_avatar_top", + "value": "84vp" + }, + { + "name": "contacts_detail_avatar_border_width", + "value": "5vp" + }, + { + "name": "contacts_detail_avatar_border_radius", + "value": "100" + }, + { + "name": "contacts_detail_user_top", + "value": "82vp" + }, + { + "name": "phone_left", + "value": "24vp" + }, + { + "name": "phone_icon_right", + "value": "24pv" + }, + { + "name": "phone_icon_left", + "value": "24pv" + }, + { + "name": "phone_column_top", + "value": "45vp" + }, + { + "name": "phone_divider_left", + "value": "24vp" + }, + { + "name": "phone_divider_right", + "value": "24vp" + }, + { + "name": "phone_divider_top", + "value": "20vp" + }, + { + "name": "last_post_left", + "value": "24vp" + }, + { + "name": "last_post_top", + "value": "17vp" + }, + { + "name": "images_left", + "value": "24vp" + }, + { + "name": "images_top", + "value": "2vp" + }, + { + "name": "images_column_left", + "value": "5vp" + }, + { + "name": "images_column_right", + "value": "5vp" + }, + { + "name": "contacts_detail_left", + "value": "31vp" + }, + { + "name": "contacts_detail_right", + "value": "31vp" + }, + { + "name": "contacts_detail_column_top", + "value": "146vp" + }, + { + "name": "alphabet_indexer_right", + "value": "16vp" + }, + { + "name": "text_input_default_font", + "value": "16vp" + }, + { + "name": "text_input_height", + "value": "40vp" + }, + { + "name": "text_input_left", + "value": "36vp" + }, + { + "name": "text_input_right", + "value": "12vp" + }, + { + "name": "small_icon_height", + "value": "16vp" + }, + { + "name": "small_icon_width", + "value": "16vp" + }, + { + "name": "add_icon_left", + "value": "12vp" + }, + { + "name": "contacts_item_padding", + "value": "3vp" + }, + { + "name": "conversation_detail_bottom_padding", + "value": "24vp" + }, + { + "name": "conversation_detail_bottom_text_padding", + "value": "3vp" + }, + { + "name": "conversation_detail_bottom_height", + "value": "56vp" + }, + { + "name": "conversation_none_icon_height", + "value": "46vp" + }, + { + "name": "conversation_none_icon_width", + "value": "50vp" + }, + { + "name": "conversation_list_time_padding", + "value": "3vp" + }, + { + "name": "conversation_list_time_width", + "value": "45vp" + }, + { + "name": "home_tab_top_lg", + "value": "6.5vp" + }, + { + "name": "home_tab_bottom_lg", + "value": "7.5vp" + }, + { + "name": "conversation_detail_path_right", + "value": "-10vp" + }, + { + "name": "path_column_top", + "value": "10vp" + }, + { + "name": "path_column_right", + "value": "12vp" + }, + { + "name": "path_column_bottom", + "value": "10vp" + }, + { + "name": "path_column_left", + "value": "12vp" + }, + { + "name": "path_top", + "value": "1vp" + }, + { + "name": "path_right", + "value": "20vp" + }, + { + "name": "path_bottom", + "value": "22vp" + }, + { + "name": "path_left", + "value": "20vp" + }, + { + "name": "message_bubble_left", + "value": "15vp" + }, + { + "name": "message_bubble_right", + "value": "16vp" + }, + { + "name": "applet_icon_size", + "value": "16vp" + }, + { + "name": "applet_icon_right", + "value": "10vp" + }, + { + "name": "applet_title_bottom", + "value": "7vp" + }, + { + "name": "applet_introduce_bottom", + "value": "8vp" + }, + { + "name": "applet_image_height", + "value": "138vp" + }, + { + "name": "applet_image_width", + "value": "186vp" + }, + { + "name": "applet_image_bottom", + "value": "6vp" + }, + { + "name": "document_text_width", + "value": "132vp" + }, + { + "name": "document_icon_size", + "value": "36vp" + }, + { + "name": "document_icon_right", + "value": "11vp" + }, + { + "name": "document_icon_bottom", + "value": "4vp" + }, + { + "name": "document_text_top", + "value": "4vp" + }, + { + "name": "document_text_bottom", + "value": "10vp" + }, + { + "name": "divider_bottom", + "value": "1vp" + }, + { + "name": "document_small_icon_size", + "value": "12vp" + }, + { + "name": "document_small_icon_right", + "value": "6vp" + }, + { + "name": "document_introduce_top", + "value": "-2vp" + }, + { + "name": "document_width", + "value": "180vp" + }, + { + "name": "document_bottom", + "value": "-7vp" + }, + { + "name": "conversation_default_text_line", + "value": "21vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/element/string.json b/MultiDeviceCommunication/features/home/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cdcacc4cc093443781952bbe2044b0da2a62c6ba --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/element/string.json @@ -0,0 +1,116 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "Message", + "value": "消息" + }, + { + "name": "Contacts", + "value": "通讯录" + }, + { + "name": "SocialCircle", + "value": "朋友圈" + }, + { + "name": "Me", + "value": "我的" + }, + { + "name": "news", + "value": "最新动态" + }, + { + "name": "group", + "value": "群组" + }, + { + "name": "card", + "value": "名片夹" + }, + { + "name": "Alan", + "value": "阿兰" + }, + { + "name": "AQin", + "value": "AQin" + }, + { + "name": "CaiLan", + "value": "菜篮" + }, + { + "name": "Deng", + "value": "邓双双" + }, + { + "name": "excel", + "value": "excel教程" + }, + { + "name": "FanYi", + "value": "翻译" + }, + { + "name": "FenFen", + "value": "芬芬" + }, + { + "name": "ge", + "value": "哥白尼" + }, + { + "name": "LiX", + "value": "李小二" + }, + { + "name": "Ma", + "value": "马老师" + }, + { + "name": "milk", + "value": "芬芬邀请你喝奶茶啦" + }, + { + "name": "Speed", + "value": "请你喝奶茶,快点单吧!!速度速度,就差你了" + }, + { + "name": "happy", + "value": "哈哈,今天有什么喜事说来听听" + }, + { + "name": "plan", + "value": "市场部2023年新产品宣传规划" + }, + { + "name": "jack", + "value": "这是明天会议的资料,请发给Jack,让他确认" + }, + { + "name": "ok", + "value": "好的,收到" + }, + { + "name": "okay", + "value": "好的,我明天过去" + }, + { + "name": "yesterday", + "value": "昨天" + }, + { + "name": "document", + "value": "文档" + }, + { + "name": "search", + "value": "搜索..." + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar1.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar1.png new file mode 100644 index 0000000000000000000000000000000000000000..efa57aa81eac396dcbbd45e959c09c3b3974c0d1 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar1.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar10.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar10.png new file mode 100644 index 0000000000000000000000000000000000000000..da9def68fd71a5279da359b8e4745df83f16b47c Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar10.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar11.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar11.png new file mode 100644 index 0000000000000000000000000000000000000000..7228b12dda3f4c692a7d277e8d5dbff210b2df3e Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar11.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar2.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar2.png new file mode 100644 index 0000000000000000000000000000000000000000..3129969b1f6ee82a44e9e1704d78f42a08f13055 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar2.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar3.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar3.png new file mode 100644 index 0000000000000000000000000000000000000000..ff61ad5ff633a05e8afdcf3d05278225019c1f02 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar3.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar4.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar4.png new file mode 100644 index 0000000000000000000000000000000000000000..fc0ce9b330540a4e28c57a93ee206787e1684607 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar4.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar5.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar5.png new file mode 100644 index 0000000000000000000000000000000000000000..6a9b663f3e42a8cede4a97083bcf5d42c76e473d Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar5.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar6.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar6.png new file mode 100644 index 0000000000000000000000000000000000000000..7228b12dda3f4c692a7d277e8d5dbff210b2df3e Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar6.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar7.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar7.png new file mode 100644 index 0000000000000000000000000000000000000000..d2c38a5575ee3a1bcaaca76a6320860436849fba Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar7.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar8.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar8.png new file mode 100644 index 0000000000000000000000000000000000000000..da9def68fd71a5279da359b8e4745df83f16b47c Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar8.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar9.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar9.png new file mode 100644 index 0000000000000000000000000000000000000000..d2c38a5575ee3a1bcaaca76a6320860436849fba Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/avatar9.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_PDF.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_PDF.png new file mode 100644 index 0000000000000000000000000000000000000000..467d75e0178f4471001675c8c3e9bee9efe303e9 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_PDF.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_file.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_file.png new file mode 100644 index 0000000000000000000000000000000000000000..3f04ffe25852a3a3097329e6f1ab595bfd582fc7 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_file.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_none_message.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_none_message.svg new file mode 100644 index 0000000000000000000000000000000000000000..e8949c04a04297c5e6bf190b2e9d0d0f0400d34e --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_none_message.svg @@ -0,0 +1,9 @@ + + + ic_空状态 + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_add_norm.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_add_norm.svg new file mode 100644 index 0000000000000000000000000000000000000000..729f2774d24c6569215b1a0f1420ea09ecf976f4 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_add_norm.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_add_norm + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_app.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_app.svg new file mode 100644 index 0000000000000000000000000000000000000000..0280940955c669cba50421e7c36715d9109549ae --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_app.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_app + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_back.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..66e3df10acde5c58b785774850139d12b0f4ad04 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cancel.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..36565c84256be091beb9bd8d8494c5e073defc3f --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cancel.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cancel + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cloud_upload.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cloud_upload.svg new file mode 100644 index 0000000000000000000000000000000000000000..ccd6af6615fc3af1fb4ee26a30fb2e364a3407b5 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_cloud_upload.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cloud_upload + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_comments.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_connection.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_connection.svg new file mode 100644 index 0000000000000000000000000000000000000000..c07d123117b9ac5b5aaeb30916bf2cbf57c9c22d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_connection.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_connection + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_contacts_group_filled.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_contacts_group_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..e91a57279b17e050d94bbe82df04576272bc8f9d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_contacts_group_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_contacts_group_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_email_send.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_email_send.svg new file mode 100644 index 0000000000000000000000000000000000000000..b06b63dd1f5e7c0862e6bb99d050d565420782ec --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_email_send.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_email_send + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_emoji.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_emoji.svg new file mode 100644 index 0000000000000000000000000000000000000000..ec6dfe21f3301987ec246051a4c042a5b3384aa6 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_emoji.svg @@ -0,0 +1,9 @@ + + + ic/ic_public_emoji + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_groups.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_groups.png new file mode 100644 index 0000000000000000000000000000000000000000..654a7872c23165d039797a973f7152837326e005 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_groups.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_more.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..2078baf063972687f6922a7f3368879eef0a0bbd --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_more + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_multiscreen.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_multiscreen.svg new file mode 100644 index 0000000000000000000000000000000000000000..98d19313337d0e762a1a396e239a91168b95391d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_multiscreen.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_multiscreen + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_names.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_names.png new file mode 100644 index 0000000000000000000000000000000000000000..2b202769eb20cd57b9a5e232e23857fccb932ece Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_names.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_phone.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..db996908441186ab8fb0be7a173ead3e9b1bec4c --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_phone.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_phone + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_play_norm.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_play_norm.svg new file mode 100644 index 0000000000000000000000000000000000000000..2d12d556d494a7540256f6ab720b56408616bfe6 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_play_norm.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_play_norm + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_refresh.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_refresh.svg new file mode 100644 index 0000000000000000000000000000000000000000..f036e290cba3bcd04e636abf68bc4868db2f8821 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_refresh.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_refresh + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..5ed76ba23b9e2c9bbd5298fdf3068f71ae64a648 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_search + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search_white.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..f9e58050aeb1995c126bfb2ae3215de123c9b517 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_search_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_search + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_share.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..593be89ad4209e315651252b2e9b5c73b94212be --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_sound.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_sound.svg new file mode 100644 index 0000000000000000000000000000000000000000..fef38f47070e3ae90b35a95c3b9194185bc9338d --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_sound.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_sound + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_switch_camera.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_switch_camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..c84bfa870a28323fded0a4ec59c1fd79a3ca4ce9 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_switch_camera.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_switch_camera + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video.svg new file mode 100644 index 0000000000000000000000000000000000000000..1a57cd7b6b89db781d56a1817866150260a0f10b --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_video + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video_filled.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..71d05632cdd4fad9836107014c0f235e23d06b60 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_video_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_video_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_voice_filled.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_voice_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..768da88933d7f1169f294f0935239c8a2a1400f9 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_voice_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_voice_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_wlan.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_wlan.svg new file mode 100644 index 0000000000000000000000000000000000000000..e6de40c6a3e1c7800f1d90b4c840b45858617075 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_public_wlan.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_wlan + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_tea.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_tea.png new file mode 100644 index 0000000000000000000000000000000000000000..87fb43a2bf3509f7e5c0ade005adabb5dc39ab5b Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/ic_tea.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_avatar.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8baf21230593fececd3074f6fd4d4e96ee9f1c Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_avatar.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts.svg new file mode 100644 index 0000000000000000000000000000000000000000..87384ef4e403669b7f591cb5bc3a0cfc40a37944 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts.svg @@ -0,0 +1,9 @@ + + + Bottom bar/icon_通讯录 + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts_selected.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..704a44087b4cc10ac305fa34b8e6d5228d7294f1 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_contacts_selected.svg @@ -0,0 +1,12 @@ + + + 通讯录 + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_me.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_me.svg new file mode 100644 index 0000000000000000000000000000000000000000..9341f6b11233abe3e35a6766eb03ea511c466c19 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_me.svg @@ -0,0 +1,14 @@ + + + BottomNavigationBar/item/normal/icon + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message.svg new file mode 100644 index 0000000000000000000000000000000000000000..fcff1b79123ff735aa93750579c15d9ef1e51ea5 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message.svg @@ -0,0 +1,9 @@ + + + Bottom bar/icon_消息_G + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message_selected.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..e7dbeaebd7d7a606d50b2dfe2bff0ad4ebca7957 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_message_selected.svg @@ -0,0 +1,9 @@ + + + Bottom bar/icon_消息_B + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle.svg new file mode 100644 index 0000000000000000000000000000000000000000..bc0a376e11e4008ec97cb2c97957eedcc65e529e --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle.svg @@ -0,0 +1,9 @@ + + + Bottom bar/icon_社交圈_G + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle_selected.svg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..c501a0a512384f6b4f5a825e76cc46b074361077 --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/media/icon_social_circle_selected.svg @@ -0,0 +1,9 @@ + + + Bottom bar/icon_社交圈_B + + + + + + \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/img.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/img.png new file mode 100644 index 0000000000000000000000000000000000000000..720a01aabcc02091c26734f02e4962814c62e504 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/img.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/picture_applet_link.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/picture_applet_link.png new file mode 100644 index 0000000000000000000000000000000000000000..f5331685059a1672760726791d3b455a1ccfd3d1 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/picture_applet_link.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/setting.jpeg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle1.png b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle1.png new file mode 100644 index 0000000000000000000000000000000000000000..c154bf4ce1ede2b1ab76d94a388748add9621005 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle1.png differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle2.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1f48c2abb9c15499951edb75092ec61bd92042a7 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle2.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle3.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c743fffbde638107707801fb7740c530c4f6cdd2 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle3.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle4.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dfb5b410f8ee457c63b3367b9391f27e4524d956 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle4.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle5.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eaa682880b28b9a834d1ddb9e97344adc6ff13a2 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle5.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle6.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e7ffcdb5f5058f36e56f66c305df951769b83da Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle6.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle7.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..48b12f781efaa4838b7396eb1455771a85f93b05 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle7.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle8.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a8f2ac8fed4d716a09ec3216bb8610efbdc2a911 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle8.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle9.jpg b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e3be34e2bdc99d1e90d5878624c3c05f4f715102 Binary files /dev/null and b/MultiDeviceCommunication/features/home/src/main/resources/base/media/social_circle9.jpg differ diff --git a/MultiDeviceCommunication/features/home/src/main/resources/base/profile/main_pages.json b/MultiDeviceCommunication/features/home/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceCommunication/features/home/src/main/resources/en_US/element/string.json b/MultiDeviceCommunication/features/home/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1cdf25e4ee85e2a11c4619c25d2fc0ed82f769bb --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/en_US/element/string.json @@ -0,0 +1,116 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "Message", + "value": "Message" + }, + { + "name": "Contacts", + "value": "Contacts" + }, + { + "name": "SocialCircle", + "value": "SocialCircle" + }, + { + "name": "Me", + "value": "Me" + }, + { + "name": "news", + "value": "Latest news" + }, + { + "name": "group", + "value": "group" + }, + { + "name": "card", + "value": "name card holder" + }, + { + "name": "Alan", + "value": "Alan" + }, + { + "name": "AQin", + "value": "AQin" + }, + { + "name": "CaiLan", + "value": "CaiLan" + }, + { + "name": "Deng", + "value": "Deng" + }, + { + "name": "excel", + "value": "excel" + }, + { + "name": "FanYi", + "value": "FanYi" + }, + { + "name": "FenFen", + "value": "FenFen" + }, + { + "name": "ge", + "value": "ge" + }, + { + "name": "LiX", + "value": "LiX" + }, + { + "name": "Ma", + "value": "Ma" + }, + { + "name": "milk", + "value": "Fen-fen invited you for milk tea" + }, + { + "name": "Speed", + "value": "Please drink milk tea, quickly order it!! Speed, speed, all that's missing is you" + }, + { + "name": "happy", + "value": "Ha-ha, what's the happy news today" + }, + { + "name": "plan", + "value": "Marketing Department 2023 new product promotion plan" + }, + { + "name": "jack", + "value": "This is the material for tomorrow's meeting. Please send it to Jack for his confirmation" + }, + { + "name": "ok", + "value": "Ok, copy that" + }, + { + "name": "okay", + "value": "Okay, I'll be there tomorrow" + }, + { + "name": "yesterday", + "value": "yesterday" + }, + { + "name": "document", + "value": "document" + }, + { + "name": "search", + "value": "Search..." + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/home/src/main/resources/zh_CN/element/string.json b/MultiDeviceCommunication/features/home/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cdcacc4cc093443781952bbe2044b0da2a62c6ba --- /dev/null +++ b/MultiDeviceCommunication/features/home/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,116 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "Message", + "value": "消息" + }, + { + "name": "Contacts", + "value": "通讯录" + }, + { + "name": "SocialCircle", + "value": "朋友圈" + }, + { + "name": "Me", + "value": "我的" + }, + { + "name": "news", + "value": "最新动态" + }, + { + "name": "group", + "value": "群组" + }, + { + "name": "card", + "value": "名片夹" + }, + { + "name": "Alan", + "value": "阿兰" + }, + { + "name": "AQin", + "value": "AQin" + }, + { + "name": "CaiLan", + "value": "菜篮" + }, + { + "name": "Deng", + "value": "邓双双" + }, + { + "name": "excel", + "value": "excel教程" + }, + { + "name": "FanYi", + "value": "翻译" + }, + { + "name": "FenFen", + "value": "芬芬" + }, + { + "name": "ge", + "value": "哥白尼" + }, + { + "name": "LiX", + "value": "李小二" + }, + { + "name": "Ma", + "value": "马老师" + }, + { + "name": "milk", + "value": "芬芬邀请你喝奶茶啦" + }, + { + "name": "Speed", + "value": "请你喝奶茶,快点单吧!!速度速度,就差你了" + }, + { + "name": "happy", + "value": "哈哈,今天有什么喜事说来听听" + }, + { + "name": "plan", + "value": "市场部2023年新产品宣传规划" + }, + { + "name": "jack", + "value": "这是明天会议的资料,请发给Jack,让他确认" + }, + { + "name": "ok", + "value": "好的,收到" + }, + { + "name": "okay", + "value": "好的,我明天过去" + }, + { + "name": "yesterday", + "value": "昨天" + }, + { + "name": "document", + "value": "文档" + }, + { + "name": "search", + "value": "搜索..." + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/Index.ets b/MultiDeviceCommunication/features/socialCircle/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d1fe2d1b6c2fa9b2f9783f91ff7c4b79bb73c68 --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/Index.ets @@ -0,0 +1 @@ +export { SocialCircle } from "./src/main/ets/pages/Index"; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/build-profile.json5 b/MultiDeviceCommunication/features/socialCircle/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/hvigorfile.ts b/MultiDeviceCommunication/features/socialCircle/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiDeviceCommunication/features/socialCircle/obfuscation-rules.txt b/MultiDeviceCommunication/features/socialCircle/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/oh-package.json5 b/MultiDeviceCommunication/features/socialCircle/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a16075ba62c8ce36a4f6a564abc9ea87ba8bb849 --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "socialcircle", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/base": "file:../../common/base" + } +} diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/ets/constants/PictureConstants.ets b/MultiDeviceCommunication/features/socialCircle/src/main/ets/constants/PictureConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..80a14f205f12a691c515d228af2d6cf11b70468d --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/ets/constants/PictureConstants.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PictureArrayInterface } from '../viewmodel/CommonViewModel'; + +export class PictureConstants { + static readonly ICON_BORDER_RADIUS = 6; + static readonly USER_NAME = $r('app.string.xiaole'); + static readonly USER_MESSAGE = $r('app.string.see'); + static readonly COLUMNS_TEMPLATE = '1fr 1fr 1fr'; + static readonly TEMPLATE_BUSINESS = '1fr'; + static readonly MAX_COLUMN_NUM = 3; +} + +function getSocialCircleList(): PictureArrayInterface[] { + const pictures: Resource[] = [ + $r('app.media.social_circle1'), + $r('app.media.social_circle2'), + $r('app.media.social_circle3'), + $r('app.media.social_circle4'), + $r('app.media.social_circle5'), + $r('app.media.social_circle6'), + $r('app.media.social_circle7'), + $r('app.media.social_circle8'), + $r('app.media.social_circle9')]; + const socialCircleList: PictureArrayInterface[] = new Array(9).fill(1) + .map((item: number, index: number): PictureArrayInterface => { + return new PictureArrayInterface(pictures.slice(0, index + 1)) + }); + return socialCircleList; +} + +export default getSocialCircleList; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/ets/pages/Index.ets b/MultiDeviceCommunication/features/socialCircle/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e8267cc937ea3518890f9ba330bb8c7738f46aa --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/ets/pages/Index.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BaseConstants } from '@ohos/base'; +import getSocialCircleList, { PictureConstants } from '../constants/PictureConstants'; +import { PictureArrayInterface, PictureInterface } from '../viewmodel/CommonViewModel'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Entry +@Component +export struct SocialCircle { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + private socialCircleList: PictureArrayInterface[] = getSocialCircleList(); + + getRowsTemplate(length: number): string { + let rowNumber: number = length % PictureConstants.MAX_COLUMN_NUM === 0 ? length / PictureConstants.MAX_COLUMN_NUM : + (Math.floor(length / PictureConstants.MAX_COLUMN_NUM) + 1) + return new Array(rowNumber).fill(PictureConstants.TEMPLATE_BUSINESS).join(' '); + } + + /** + * get picture aspect ratio + */ + getAspectRatio(length: number): number { + let rowNumber: number = length % PictureConstants.MAX_COLUMN_NUM === 0 ? length / PictureConstants.MAX_COLUMN_NUM : + (Math.floor(length / PictureConstants.MAX_COLUMN_NUM) + 1) + + return PictureConstants.MAX_COLUMN_NUM / rowNumber + } + + build() { + Flex({ direction: FlexDirection.Column }) { + List() { + ForEach(this.socialCircleList, (item: PictureArrayInterface) => { + ListItem() { + this.CircleItem(item) + } + }, (item: PictureArrayInterface, index: number) => index + JSON.stringify(item)) + } + .width(BaseConstants.FULL_WIDTH) + .height(BaseConstants.FULL_HEIGHT) + } + .backgroundColor(Color.White) + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top') + }) + } + + @Builder + CircleItem(pictureArray: PictureArrayInterface) { + Flex() { + Image($r('app.media.icon_avatar')) + .height($r('app.float.icon_height')) + .width($r('app.float.icon_width')) + .margin({ right: $r('app.float.icon_right') }) + .borderRadius(PictureConstants.ICON_BORDER_RADIUS) + .objectFit(ImageFit.Auto) + Column() { + Text(PictureConstants.USER_NAME) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + .fontColor(Color.Black) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + .margin({ bottom: $r('app.float.user_name_bottom') }) + Text(PictureConstants.USER_MESSAGE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TWELVE) + .fontColor(Color.Black) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .margin({ bottom: $r('app.float.user_message_bottom') }) + + Grid() { + ForEach(pictureArray.pictures, (picture: PictureInterface) => { + GridItem() { + Image(picture.src) + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + .autoResize(true) + + } + }, (picture: PictureInterface, index: number) => index + JSON.stringify(picture)) + } + .rowsTemplate(this.getRowsTemplate(pictureArray.pictures.length)) + .columnsTemplate(PictureConstants.COLUMNS_TEMPLATE) + .columnsGap($r('app.float.picture_gap')) + .rowsGap($r('app.float.picture_gap')) + .aspectRatio(this.getAspectRatio(pictureArray.pictures.length)) + .width(BaseConstants.FULL_WIDTH) + } + .alignItems(HorizontalAlign.Start) + .flexShrink(BaseConstants.FLEX_SHRINK_ONE) + .width(BaseConstants.FULL_WIDTH) + } + .padding({ + left: $r('app.float.header_left'), + right: $r('app.float.header_right'), + top: $r('app.float.header_top'), + bottom: $r('app.float.header_bottom') + }) + .width(BaseConstants.FULL_WIDTH) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/ets/viewmodel/CommonViewModel.ets b/MultiDeviceCommunication/features/socialCircle/src/main/ets/viewmodel/CommonViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..da577890cc4978931db18c5a285cf2e04fff46af --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/ets/viewmodel/CommonViewModel.ets @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2023 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. +*/ + + +interface SocialCircleItemInterface { + icon: Resource; + name: string; + msg: string; + pictureList: PictureInterface[]; +}; + +/** + * Picture array interface + */ +class PictureArrayInterface { + pictures: PictureInterface[] = []; + + constructor(pictureSource: Resource[]) { + pictureSource.forEach(item => { + this.pictures.push(new PictureInterface(item)); + }) + } +} + +/** + * Picture interface + */ +class PictureInterface { + src: Resource; + + constructor(src: Resource) { + this.src = src; + } +} + +export { SocialCircleItemInterface, PictureArrayInterface, PictureInterface }; \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/module.json5 b/MultiDeviceCommunication/features/socialCircle/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..56bf3a0762b62cf20803c4885bd7b94094afb13e --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "socialCircle", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/color.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/float.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..0cd621cb6dc2ea17edd3159f59e9488bfbe32650 --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/float.json @@ -0,0 +1,52 @@ +{ + "float": [ + { + "name": "icon_height", + "value": "40vp" + }, + { + "name": "icon_width", + "value": "40vp" + }, + { + "name": "icon_right", + "value": "8vp" + }, + { + "name": "user_name_bottom", + "value": "6vp" + }, + { + "name": "user_message_bottom", + "value": "8vp" + }, + { + "name": "header_top", + "value": "16vp" + }, + { + "name": "header_right", + "value": "20vp" + }, + { + "name": "header_bottom", + "value": "16vp" + }, + { + "name": "header_left", + "value": "24vp" + }, + { + "name": "picture_gap", + "value": "2vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/string.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..404d06f8f95b4033d7dfafa78c7c4fff1e22e1cc --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "xiaole", + "value": "晓乐" + }, + { + "name": "see", + "value": "挺有意思的,大家都来看看吧!挺有意思的,大家都来看看吧!" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon.png b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon_avatar.png b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8baf21230593fececd3074f6fd4d4e96ee9f1c Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/icon_avatar.png differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/setting.jpeg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle1.png b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle1.png new file mode 100644 index 0000000000000000000000000000000000000000..c154bf4ce1ede2b1ab76d94a388748add9621005 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle1.png differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle2.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1f48c2abb9c15499951edb75092ec61bd92042a7 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle2.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle3.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c743fffbde638107707801fb7740c530c4f6cdd2 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle3.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle4.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dfb5b410f8ee457c63b3367b9391f27e4524d956 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle4.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle5.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eaa682880b28b9a834d1ddb9e97344adc6ff13a2 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle5.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle6.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e7ffcdb5f5058f36e56f66c305df951769b83da Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle6.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle7.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..48b12f781efaa4838b7396eb1455771a85f93b05 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle7.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle8.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a8f2ac8fed4d716a09ec3216bb8610efbdc2a911 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle8.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle9.jpg b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e3be34e2bdc99d1e90d5878624c3c05f4f715102 Binary files /dev/null and b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/media/social_circle9.jpg differ diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/profile/main_pages.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/en_US/element/string.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f87a266bdcd01b532f05954949e6e09f217c8b6e --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "xiaole", + "value": "xiaole" + }, + { + "name": "see", + "value": "It's fun. Let's see! It's fun. Let's see!" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/features/socialCircle/src/main/resources/zh_CN/element/string.json b/MultiDeviceCommunication/features/socialCircle/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..404d06f8f95b4033d7dfafa78c7c4fff1e22e1cc --- /dev/null +++ b/MultiDeviceCommunication/features/socialCircle/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "xiaole", + "value": "晓乐" + }, + { + "name": "see", + "value": "挺有意思的,大家都来看看吧!挺有意思的,大家都来看看吧!" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/hvigor/hvigor-config.json5 b/MultiDeviceCommunication/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..eb31f8301a08fedbf8ca8dd0c17b84a8347d8220 --- /dev/null +++ b/MultiDeviceCommunication/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 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. + */ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/oh-package.json5 b/MultiDeviceCommunication/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d7b0d0c182ef150b3679db30b6e3176ef22ff906 --- /dev/null +++ b/MultiDeviceCommunication/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + }, + "author": "", + "name": "MultiDeviceCommunication", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiDeviceCommunication/products/phone/build-profile.json5 b/MultiDeviceCommunication/products/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a23921541b20eb9a3e508caebc366290ba0c7c45 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/build-profile.json5 @@ -0,0 +1,41 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS", + "config": { + "deviceType": [ + "phone", + "tablet", + "2in1" + ] + }, + "source": { + "pages": [ + "pages/Index", + ] + } + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/hvigorfile.ts b/MultiDeviceCommunication/products/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiDeviceCommunication/products/phone/obfuscation-rules.txt b/MultiDeviceCommunication/products/phone/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiDeviceCommunication/products/phone/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/oh-package.json5 b/MultiDeviceCommunication/products/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3a42fb815a1c9799df92ed1bf68ee229c57c68ec --- /dev/null +++ b/MultiDeviceCommunication/products/phone/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/base": "file:../../common/base", + "@ohos/home": "file:../../features/home" + } +} diff --git a/MultiDeviceCommunication/products/phone/src/main/ets/entryability/EntryAbility.ets b/MultiDeviceCommunication/products/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..5dc59b8c78a176901168d938deb8e61f1a359177 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UIAbility } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { display, KeyboardAvoidMode, window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { BaseConstants, BreakpointConstants } from '@ohos/base/Index'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +export default class EntryAbility extends UIAbility { + private windowObj?: window.Window; + + onCreate(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + windowStage.getMainWindow((err: BusinessError, data) => { + this.windowObj = data; + this.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', (windowSize: window.Size) => { + this.updateBreakpoint(windowSize.width); + }) + if (err.code) { + hilog.info(0x0000, 'testTag', '%{public}s', 'getMainWindow failed'); + return; + } + if (deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1) { + data.setWindowLayoutFullScreen(true); + } + }) + + windowStage.loadContent('pages/Index', (err, data) => { + let a = windowStage.getMainWindowSync().getUIContext().getKeyboardAvoidMode(); + windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.OFFSET); + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + private updateBreakpoint(windowWidth: number): void { + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[2]) { + curBp = BreakpointConstants.BREAKPOINT_SM; + } else if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[3]) { + curBp = BreakpointConstants.BREAKPOINT_MD; + } else { + curBp = BreakpointConstants.BREAKPOINT_LG; + } + AppStorage.setOrCreate('currentBreakpoint', curBp); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/MultiDeviceCommunication/products/phone/src/main/ets/pages/Index.ets b/MultiDeviceCommunication/products/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..19c559e9db3cd76a1fdf2f13647c242a84248cf7 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Home } from '@ohos/home'; +import { BaseConstants, BreakpointConstants } from '@ohos/base'; + +@Entry +@Component +struct Index { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + + build() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[0], + lg: BreakpointConstants.GRID_COLUMN_SPANS[0] + } }) { + Column() { + Home() + } + .width(BaseConstants.FULL_HEIGHT) + .height(BaseConstants.FULL_HEIGHT) + + } + .height(BaseConstants.FULL_PERCENT) + .width(BaseConstants.FULL_PERCENT) + } + .onBreakpointChange((breakPoints) => { + this.currentBreakpoint = breakPoints; + }) + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/src/main/module.json5 b/MultiDeviceCommunication/products/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..09cd4fd52713f97c0d27a94e376d10bcfa9faf71 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/module.json5 @@ -0,0 +1,40 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "minWindowWidth": 360, + "minWindowHeight": 600, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/element/color.json b/MultiDeviceCommunication/products/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/element/string.json b/MultiDeviceCommunication/products/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bd663d0c1325781ea8ba0960676ea4e2a8bb1f7b --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/resources/base/element/string.json @@ -0,0 +1,33 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "AppletAbility_desc", + "value": "description" + }, + { + "name": "DocumentAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "一多即时通讯" + }, + { + "name": "AppletAbility_label", + "value": "一多即时通讯" + }, + { + "name": "DocumentAbility_label", + "value": "一多即时通讯" + } + + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/media/PC_WPS.png b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/PC_WPS.png new file mode 100644 index 0000000000000000000000000000000000000000..1145dc4dc0ec223e012b3afbe7221594e028ddf8 Binary files /dev/null and b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/PC_WPS.png differ diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/media/icon.png b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/media/startIcon.png b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/MultiDeviceCommunication/products/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/base/profile/main_pages.json b/MultiDeviceCommunication/products/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/en_US/element/string.json b/MultiDeviceCommunication/products/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c88e85808e747b8df8503ed0b5780a610d329694 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,31 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "AppletAbility_desc", + "value": "description" + },{ + "name": "DocumentAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiDeviceCommunication" + }, + { + "name": "AppletAbility_label", + "value": "MultiDeviceCommunication" + }, + { + "name": "DocumentAbility_label", + "value": "MultiDeviceCommunication" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/products/phone/src/main/resources/zh_CN/element/string.json b/MultiDeviceCommunication/products/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4fa67ee3394feba81ae7827d0a4e39af61ea3860 --- /dev/null +++ b/MultiDeviceCommunication/products/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "AppletAbility_desc", + "value": "description" + }, + { + "name": "DocumentAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "一多即时通讯" + }, + { + "name": "AppletAbility_label", + "value": "一多即时通讯" + }, + { + "name": "DocumentAbility_label", + "value": "一多即时通讯" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceCommunication/screenshots/device/config.PNG b/MultiDeviceCommunication/screenshots/device/config.PNG new file mode 100644 index 0000000000000000000000000000000000000000..a9512a8ea67f0fba8704a86ad743b6fdd635355b Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/config.PNG differ diff --git a/MultiDeviceCommunication/screenshots/device/foldable.png b/MultiDeviceCommunication/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..6ffefcd480fd274c3aca01af8984578fe4356bca Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/foldable.png differ diff --git a/MultiDeviceCommunication/screenshots/device/foldable_EN.png b/MultiDeviceCommunication/screenshots/device/foldable_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..6d7b6ad297bb6232288a1ab2ddd4751165a37e52 Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/foldable_EN.png differ diff --git a/MultiDeviceCommunication/screenshots/device/pad.png b/MultiDeviceCommunication/screenshots/device/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..200887d5948ace1d39c31c41c5d01a97aa8abbd0 Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/pad.png differ diff --git a/MultiDeviceCommunication/screenshots/device/pad_EN.png b/MultiDeviceCommunication/screenshots/device/pad_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..72e879b2a431160394da02a201d1fd117332cfbb Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/pad_EN.png differ diff --git a/MultiDeviceCommunication/screenshots/device/phone.png b/MultiDeviceCommunication/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..9e8f7e56d51596613586832aff0888489068eb33 Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/phone.png differ diff --git a/MultiDeviceCommunication/screenshots/device/phone_EN.png b/MultiDeviceCommunication/screenshots/device/phone_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..d91f74fa6378c2e46eb2de46c4002ed6b5361084 Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/phone_EN.png differ diff --git a/MultiDeviceCommunication/screenshots/device/run.png b/MultiDeviceCommunication/screenshots/device/run.png new file mode 100644 index 0000000000000000000000000000000000000000..7655fa7e041bb067e028029d820bd2d320e2cd83 Binary files /dev/null and b/MultiDeviceCommunication/screenshots/device/run.png differ diff --git a/MultiFinancialManagement/AppScope/app.json5 b/MultiFinancialManagement/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..bea217714e212db8b7bf8a2e12c3346af5d676b9 --- /dev/null +++ b/MultiFinancialManagement/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.multifinancialmanagement", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/MultiFinancialManagement/AppScope/resources/base/element/string.json b/MultiFinancialManagement/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..747b13ddc8f562513a73ad70009a15fd6d4d73e6 --- /dev/null +++ b/MultiFinancialManagement/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiFinancialManagement" + } + ] +} diff --git a/MultiFinancialManagement/AppScope/resources/base/media/app_icon.png b/MultiFinancialManagement/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/MultiFinancialManagement/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiFinancialManagement/LICENSE b/MultiFinancialManagement/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/MultiFinancialManagement/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + + 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/MultiFinancialManagement/README.en.md b/MultiFinancialManagement/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..2001d7f830440e57b6172752c9cbb9cb996b0ea8 --- /dev/null +++ b/MultiFinancialManagement/README.en.md @@ -0,0 +1,36 @@ +# Bank Wealth Management + +### Introduction + +This codelab implements a bank wealth management app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. + +The figure shows the effect on the mobile phone: + + + +The figure shows the effect on the foldable phone: + + + +The figure shows the effect on the tablet: + + + +### Permissions + +N/A + +### How to Use + +1. Install and open an app on a mobile phone, foldable phone, or tablet. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +2. Tap the image under featured fortune to go to the product details page. +3. Tap the steady growth content on the page to go to the fund details page. +4. Tap Compare button at the bottom of the fund details page to go to the fund comparison page. +5. Select a fund and tap Start Comparison on the fund details page to go to the fund comparison page. + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later +3. DevEco Studio: DevEco Studio 5.0.0 Release or later +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later diff --git a/MultiFinancialManagement/README.md b/MultiFinancialManagement/README.md new file mode 100644 index 0000000000000000000000000000000000000000..67b24bc5080f1a85655654cd189e346660419b16 --- /dev/null +++ b/MultiFinancialManagement/README.md @@ -0,0 +1,36 @@ +# 一次开发,多端部署-银行理财 + +### 简介 + +基于自适应和响应式布局,实现一次开发、多端部署银行理财。 + +手机效果图如下: + + + +折叠屏效果图如下: + + + +平板效果图如下: + + + +### 相关权限 + +不涉及 + +### 使用说明 + +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 点击界面内财富精选下的图片跳转到产品详情页。 +3. 点击界面内稳健增长内容跳转到基金详情页。 +4. 点击基金详情页下方对比跳转至基金比较页。 +5. 基金详情页勾选基金后点击开始对比跳转至基金比较页。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 \ No newline at end of file diff --git a/MultiFinancialManagement/build-profile.json5 b/MultiFinancialManagement/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4fb1e6f33233556c1caa56be2fd142cb9ed50fa8 --- /dev/null +++ b/MultiFinancialManagement/build-profile.json5 @@ -0,0 +1,95 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./product/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "basic", + "srcPath": "./commons/basic", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "home", + "srcPath": "./features/home", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "fund", + "srcPath": "./features/fund", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "fundComparison", + "srcPath": "./features/fundComparison", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "transaction", + "srcPath": "./features/transaction", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/Index.ets b/MultiFinancialManagement/commons/basic/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..06829cca5599dd6a8f9a361b31afb0f78de54876 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/Index.ets @@ -0,0 +1,6 @@ +export { CommonConstants } from './src/main/ets/constants/CommonConstants'; +export { RouterConstants } from './src/main/ets/constants/RouterConstants'; +export { BreakpointUtil } from './src/main/ets/utils/BreakpointUtil'; +export { logger } from './src/main/ets/utils/Logger'; +export { BusinessInfo } from './src/main/ets/viewmodel/BusinessInfo'; +export { FundDetail } from './src/main/ets/viewmodel/FundDetail'; diff --git a/MultiFinancialManagement/commons/basic/build-profile.json5 b/MultiFinancialManagement/commons/basic/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiFinancialManagement/commons/basic/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/hvigorfile.ts b/MultiFinancialManagement/commons/basic/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/commons/basic/obfuscation-rules.txt b/MultiFinancialManagement/commons/basic/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/commons/basic/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/oh-package.json5 b/MultiFinancialManagement/commons/basic/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a17234d269b9b51ca36a6cf80ed5722d21ae730a --- /dev/null +++ b/MultiFinancialManagement/commons/basic/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "basic", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/constants/CommonConstants.ets b/MultiFinancialManagement/commons/basic/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e807259223d0744f79fd5a6c77c23b624ee1d39 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Common constants for all features. + */ +export class CommonConstants { + /** + * Breakpoint xs. + */ + static readonly BREAK_POINT_XS: string = 'xs'; + + /** + * Breakpoint sm. + */ + static readonly BREAK_POINT_SM: string = 'sm'; + + /** + * Breakpoint md. + */ + static readonly BREAK_POINT_MD: string = 'md'; + + /** + * Breakpoint lg. + */ + static readonly BREAK_POINT_LG: string = 'lg'; + + /** + * The break point value. + */ + static readonly BREAK_POINTS_VALUE: Array = ['320vp', '600vp', '840vp']; + + /** + * The break point value. + */ + static readonly BREAK_POINTS_VALUE_NUMBER: Array = [320, 600, 840]; + + /** + * The number of columns for SM device. + */ + static readonly COLUMN_SM: number = 4; + + /** + * The number of columns for MD device. + */ + static readonly COLUMN_MD: number = 8; + + /** + * The number of columns for LG device. + */ + static readonly COLUMN_LG: number = 12; + + /** + * The full percentage of component. + */ + static readonly FULL_WIDTH_PERCENT: string = '100%'; + + /** + * The full percentage of component. + */ + static readonly FULL_HEIGHT_PERCENT: string = '100%'; + + /** + * Tab bar height. + */ + static readonly TAB_BAR_HEIGHT_PERCENT: string = '100%'; + + /** + * Tab height. + */ + static readonly TAB_HEIGHT_PERCENT: string = '50%'; + + /** + * Navigation path key of detail. + */ + static readonly PATH_DETAIL: string = 'detail'; + + /** + * Navigation path key of comparison. + */ + static readonly PATH_COMPARISON: string = 'comparison'; + + /** + * Navigation path key of comparisonDetail. + */ + static readonly PATH_COMPARISON_DETAIL: string = 'comparisonDetail'; + + /** + * Navigation path key of buying. + */ + static readonly PATH_BUYING: string = 'buying'; + + /** + * Common font weight. + */ + static readonly FONT_WEIGHT_500: number = 500; + + /** + * Common font weight. + */ + static readonly FONT_WEIGHT_700: number = 700; + + /** + * Common font family. + */ + static readonly FONT_FAMILY_HEI_TI: string = 'HarmonyHeiTi-Medium'; +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/constants/RouterConstants.ets b/MultiFinancialManagement/commons/basic/src/main/ets/constants/RouterConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..971a8c5ba2c047202197b90d99cd0ece0d3afad6 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/constants/RouterConstants.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Router constants for all features. + */ +export class RouterConstants { + /** + * The funding detail page url. + */ + static readonly FUNDING_DETAIL_URL: string = 'FundingDetail'; + + /** + * The funding page url. + */ + static readonly FUNDING_URL: string = 'Funding'; + + /** + * The trends page url. + */ + static readonly TRENDS_PAGE_URL: string = 'TrendsPage'; + + /** + * The comparison detail page url. + */ + static readonly COMPARISON_PAGE_URL: string = 'ComparisonDetailPage'; + + /** + * The comparison detail page url. + */ + static readonly ACCOUNT_PAGE_URL: string = 'AccountPage'; +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/utils/BreakpointUtil.ets b/MultiFinancialManagement/commons/basic/src/main/ets/utils/BreakpointUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7f4413f067fc9a4e98bbb03243210d9d36f88e4 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/utils/BreakpointUtil.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 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. + */ + +declare interface BreakPointOption extends Record { + sm?: T, + md?: T, + lg?: T, + xl?: T, + xxl?: T +} + +export class BreakpointUtil { + options: BreakPointOption; + + constructor(option: BreakPointOption) { + this.options = option; + } + + getValue(currentPoint: string): T { + return this.options[currentPoint] as T; + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/utils/Logger.ets b/MultiFinancialManagement/commons/basic/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..748109dff1f6bc518942e8bcc8d2f508f6eb1637 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/utils/Logger.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + +const LOG_DOMAIN: number = 0xFF00; + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + constructor(prefix: string, domain: number) { + this.prefix = prefix; + this.domain = domain; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export const logger = new Logger('MultiFinancialManagement', LOG_DOMAIN); \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets b/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed1f34b617d1dede967aecc6a725b584c98e8747 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Home page information entity class. + */ +export class BusinessInfo { + icon: Resource; + text: ResourceStr; + router?: string; + iconBig?: Resource; + + constructor(icon: Resource, text: ResourceStr, iconBig?: Resource, router?: string) { + this.icon = icon; + this.text = text; + this.iconBig = iconBig + this.router = router; + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/FundDetail.ets b/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/FundDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..babf9f6d289df8ef0e21b225badccf66202435c5 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/ets/viewmodel/FundDetail.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Basic fund information. + */ +export class FundDetail { + name: ResourceStr; + amplitude: ResourceStr; + + constructor(name: ResourceStr, amplitude: ResourceStr) { + this.name = name; + this.amplitude = amplitude; + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/module.json5 b/MultiFinancialManagement/commons/basic/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6823e5bd3cad8ec31f718f4decd76f50a5244775 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "basic", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/resources/base/element/color.json b/MultiFinancialManagement/commons/basic/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/resources/base/element/string.json b/MultiFinancialManagement/commons/basic/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiFinancialManagement/commons/basic/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/commons/basic/src/main/resources/base/media/icon.png b/MultiFinancialManagement/commons/basic/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiFinancialManagement/commons/basic/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/features/fund/Index.ets b/MultiFinancialManagement/features/fund/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c90b6ba4549bd22467d6642e2bf088876e7bf33c --- /dev/null +++ b/MultiFinancialManagement/features/fund/Index.ets @@ -0,0 +1,3 @@ +export { Funding } from './src/main/ets/view/Funding'; +export { FundingDetail } from './src/main/ets/view/FundingDetail'; +export { TrendsPage } from './src/main/ets/view/TrendsPage'; \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/build-profile.json5 b/MultiFinancialManagement/features/fund/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiFinancialManagement/features/fund/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/hvigorfile.ts b/MultiFinancialManagement/features/fund/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiFinancialManagement/features/fund/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/features/fund/obfuscation-rules.txt b/MultiFinancialManagement/features/fund/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/features/fund/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/oh-package.json5 b/MultiFinancialManagement/features/fund/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7e2de41fd8cc9050ee29a7c7fdecce285811c29a --- /dev/null +++ b/MultiFinancialManagement/features/fund/oh-package.json5 @@ -0,0 +1,17 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "fund", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/transaction": "file:../transaction", + "@ohos/fundComparison": "file:../fundComparison", + "@ohos/basic": "file:../../commons/basic", + "@ohos/mpchart": "^3.0.0-rc.1" + } +} diff --git a/MultiFinancialManagement/features/fund/src/main/ets/constants/FundConstants.ets b/MultiFinancialManagement/features/fund/src/main/ets/constants/FundConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0f05d611c2b793fe7212bb6e13ca10a46d8eca8 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/constants/FundConstants.ets @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Fund constants for fund feature. + */ +export class FundConstants { + /** + * Row space. + */ + static readonly ROW_SPACE: number = 8; + + /** + * Column space. + */ + static readonly COLUMN_SPACE: number = 6; + + /** + * Column space. + */ + static readonly TAB_COLUMN_SPACE: number = 4; + + /** + * Row space. + */ + static readonly BOTTOM_ROW_SPACE: number = 24; + + /** + * Row space. + */ + static readonly TAB_ROW_SPACE: number = 20; + + /** + * Column space. + */ + static readonly BOTTOM_COLUMN_SPACE: number = 24; + + /** + * Row space. + */ + static readonly COLLECT_COLUMN_SPACE: number = 4; + + /** + * Get fund info start index. + */ + static readonly FUND_COUNT_START: number = 0; + + /** + * Get fund info under sm power outage. + */ + static readonly FUND_COUNT_SM: number = 4; + + /** + * Get fund info under md power outage. + */ + static readonly FUND_COUNT_MD: number = 6; + + /** + * Get fund info under lg power outage. + */ + static readonly FUND_COUNT_LG: number = 12; + + /** + * Get list lanes under sm power outage. + */ + static readonly LIST_LANES_SM: number = 2; + + /** + * Get list lanes under md power outage. + */ + static readonly LIST_LANES_MD: number = 3; + + /** + * Get list lanes under lg power outage. + */ + static readonly LIST_LANES_LG: number = 5; + + /** + * Get button count under sm power outage. + */ + static readonly BUTTON_COUNT_SM: number = 5; + + /** + * Get button count under md power outage. + */ + static readonly BUTTON_COUNT_MD: number = 6; + + /** + * Get column count under sm power outage. + */ + static readonly COLUMN_COUNT_SM: number = 2; + + /** + * Get column count under md power outage. + */ + static readonly COLUMN_COUNT_MD: number = 3; + + /** + * Gradient position. + */ + static readonly GRADIENT_LEFT: number = 0; + + /** + * Gradient position. + */ + static readonly GRADIENT_CENTER: number = 0.91; + + /** + * Gradient position. + */ + static readonly GRADIENT_RIGHT: number = 1; + + /** + * Calculate the position value. + */ + static readonly CALCULATE_POSITION_LG: number = 216; + + /** + * Calculate the position value. + */ + static readonly CALCULATE_POSITION: number = 146; + + /** + * Nav bar width. + */ + static readonly NAV_BAR_WIDTH: string = '40%'; +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/ChartLegendComponent.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/ChartLegendComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b79e53969ed6754084647e67b2bc5dd75408a2b --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/ChartLegendComponent.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 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. + */ + +@Component +export struct ChartLegendComponent { + private name: ResourceStr = ''; + private color: ResourceStr = ''; + private value: ResourceStr = ''; + + build() { + Column() { + Row() { + Text(this.name) + .fontSize($r('app.float.text_name_size')) + .fontColor($r('app.color.name_build_text')); + Divider() + .width($r('app.float.build_divider_width')) + .height($r('app.float.build_divider_height')) + .color(this.color) + .borderRadius($r('app.float.build_divider_radius')) + .margin({ + left: $r('app.float.build_divider_margin_left') + }) + } + Text(this.value) + .fontColor($r('app.color.value_build_text')) + .fontSize($r('app.float.value_build_text_size')); + } + .alignItems(HorizontalAlign.Start) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/DetailComponent.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/DetailComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..cac46e3618c6c61a18503990ecbe8928b022bd11 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/DetailComponent.ets @@ -0,0 +1,428 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { LineChart, LineChartModel } from '@ohos/mpchart'; +import { BreakpointUtil, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; +import ChartViewModel from '../viewmodel/ChartViewModel'; +import FundingViewModel from '../viewmodel/FundingViewModel'; +import { FundConstants } from '../constants/FundConstants'; +import { ChartLegendComponent } from './ChartLegendComponent'; + +@Component +export struct DetailComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_LG; + @State lineChartModel: LineChartModel = ChartViewModel.getLineChartModel(); + @State showChart: boolean = true; + @State indexList: number = 0; + @State tabBarIndex: number = 0; + @State fundInfo: FundDetail[] = FundingViewModel.getAllFundInfo(); + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + Text($r('app.string.funding_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('sys.color.mask_secondary')) + Image($r('app.media.ic_public_share')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.title_height')) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Center) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Scroll() { + Column() { + Column() { + Row() { + Text(this.fundInfo[this.indexList].name) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.name_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.funding_code')) + .fontSize($r('app.float.code_size')) + .fontColor($r('app.color.forty_percent_white')) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Row({ space: FundConstants.ROW_SPACE }) { + Text($r('app.string.currency_type')) + .buildTextStyle() + Text($r('app.string.medium_risk')) + .buildTextStyle() + Text($r('app.string.purchase_rmb')) + .buildTextStyle() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + top: $r('app.float.type_margin_top'), + bottom: $r('app.float.type_margin_bottom') + }) + + Row() { + Column({ space: FundConstants.COLUMN_SPACE }) { + Text(this.fundInfo[this.indexList].amplitude) + .fontSize($r('app.float.amplitude_size')) + .fontColor($r('app.color.amplitude_text')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + + Column({ space: FundConstants.COLUMN_SPACE }) { + Text($r('app.string.one_day_amplitude_data')) + .fontSize($r('app.float.amplitude_date_size')) + .fontColor($r('app.color.amplitude_date')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.one_day_amplitude')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + + Column({ space: FundConstants.COLUMN_SPACE }) { + Text($r('app.string.last_net_value_data')) + .fontSize($r('app.float.amplitude_date_size')) + .fontColor(Color.Black) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.last_net_value')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Bottom) + + Row() { + Text($r('app.string.last_net_value')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + Text($r('app.string.last_net_not_show')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + left: $r('app.float.last_net_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + top: $r('app.float.last_net_margin_tb'), + bottom: $r('app.float.last_net_margin_tb') + }) + + Row() { + Text($r('app.string.three_year_rating')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + right: $r('app.float.rating_margin_right') + }) + Rating() + .height($r('app.float.rating_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + } + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.scroll_column_padding_right'), + top: $r('app.float.scroll_column_padding_top'), + bottom: $r('app.float.scroll_column_padding_bottom') + }) + .margin({ + top: $r('app.float.scroll_column_margin'), + bottom: $r('app.float.scroll_column_margin') + }) + + Column() { + Row() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Text($r('app.string.performance_trends')) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.unit_net_value')) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 1; + this.controller.changeIndex(this.tabBarIndex); + }) + } + Image($r('app.media.ic_public_enlarge')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pushPathByName(RouterConstants.TRENDS_PAGE_URL, + { 'name': this.fundInfo[this.indexList].name } as Record); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + bottom: $r('app.float.tab_bar_top') + }) + Tabs({ controller: this.controller }) { + TabContent() { + Column() { + Row() { + ChartLegendComponent({ + name: $r('app.string.the_fund'), + color: $r('app.color.fund_chart'), + value: $r('app.string.the_fund_value') + }) + ChartLegendComponent({ + name: $r('app.string.same_average'), + color: $r('app.color.same_average_chart'), + value: $r('app.string.same_average_value') + }) + ChartLegendComponent({ + name: $r('app.string.other_funding'), + color: $r('app.color.other_funding_chart'), + value: $r('app.string.other_funding_value') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + + Row() { + LineChart({ model: this.lineChartModel }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .layoutWeight(1) + + Row() { + Button($r('app.string.near_month', 1)) + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.harmony_blue')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor($r('app.color.five_percent_white_fund')) + .height($r('app.float.chart_button_height')) + .width(new BreakpointUtil({ + sm: $r('app.float.chart_button_min_width'), + md: $r('app.float.chart_button_max_width'), + lg: $r('app.float.chart_button_max_width') + }).getValue(this.currentPoint)) + Button($r('app.string.near_month', 3)) + .chartButtonStyle() + Button($r('app.string.near_month', 6)) + .chartButtonStyle() + Button($r('app.string.near_year', 1)) + .chartButtonStyle() + Button($r('app.string.near_year', 3)) + .chartButtonStyle() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height('30vp') + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.chart_button_margin') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .tabBar($r('app.string.performance_trends')) + + TabContent() { + + } + .tabBar($r('app.string.unit_net_value')) + } + .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_margin')}) + .barHeight(0) + .scrollable(false) + .layoutWeight(1) + } + .backgroundColor(Color.White) + .layoutWeight(1) + .padding({ + top: $r('app.float.image_enlarge_margin'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .justifyContent(FlexAlign.Start) + } + .align(Alignment.TopStart) + .layoutWeight(1) + .scrollBar(BarState.Off) + + Row() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Column({ space: FundConstants.COLLECT_COLUMN_SPACE }) { + Image($r('app.media.ic_public_copy_fund')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.funding_contrasts')) + .fontSize($r('app.float.contrasts_size')) + } + .onClick(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_COMPARISON }) + }) + Column({ space: FundConstants.COLLECT_COLUMN_SPACE }) { + Image($r('app.media.ic_public_collect_fund')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.funding_concerned')) + .fontSize($r('app.float.contrasts_size')) + } + } + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Button($r('app.string.fixed_investment_button')) + .width(new BreakpointUtil({ + sm: $r('app.float.bottom_button_width'), + md: $r('app.float.bottom_button_width_md'), + lg: $r('app.float.bottom_button_width_md') + }).getValue(this.currentPoint)) + .height($r('app.float.bottom_button_height')) + .backgroundColor($r('app.color.five_percent_white_fund')) + .fontColor($r('app.color.bottom_button')) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Button($r('app.string.buying_button')) + .width(new BreakpointUtil({ + sm: $r('app.float.bottom_button_width'), + md: $r('app.float.bottom_button_width_md'), + lg: $r('app.float.bottom_button_width_md') + }).getValue(this.currentPoint)) + .height($r('app.float.bottom_button_height')) + .backgroundColor($r('app.color.harmony_blue')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .onClick(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_BUYING, param: this.indexList }); + }) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + top: $r('app.float.bottom_padding_tb'), + bottom: $r('app.float.bottom_padding_tb'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + .hideTitleBar(true) + .backgroundColor($r('app.color.common_background')) + .onBackPressed(() => { + this.pageIndexInfos.pop(); + return true; + }) + } +} + +@Extend(Button) +function chartButtonStyle() { + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('sys.color.mask_secondary')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor(Color.White) + .height($r('app.float.chart_button_height')) + .constraintSize({ + minWidth: $r('app.float.chart_button_min_width'), + maxWidth: $r('app.float.chart_button_max_width') + }) +} + +@Extend(Text) +function buildTextStyle() { + .fontSize($r('app.float.currency_size')) + .fontColor($r('app.color.currency_font')) + .border({ + width: $r('app.float.common_divider'), + color: $r('app.color.currency_border'), + radius: $r('app.float.currency_border_radius') + }) + .padding({ + top: $r('app.float.currency_padding_tb'), + bottom: $r('app.float.currency_padding_tb'), + left: $r('app.float.currency_padding_lr'), + right: $r('app.float.currency_padding_lr') + }) +} diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/FundComponent.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/FundComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..ced88e16b2842facd04961b632c75bd6a6e6e450 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/FundComponent.ets @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; +import { FundConstants } from '../constants/FundConstants'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Component + // [Start fund_component] +export struct FundComponent { + // [StartExclude fund_component] + @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @State tabBarIndex: number = 0; + @State backgroundX: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + + build() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + + Search({ placeholder: $r('app.string.search_placeholder') }) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + .enableKeyboardOnFocus(false) + .placeholderColor($r('sys.color.mask_secondary')) + .borderColor($r('app.color.five_percent_white_fund')) + .searchIcon({ + color: $r('sys.color.mask_secondary') + }) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.search_width_sm') : $r('app.float.search_width')) + .margin({ + left: $r('app.float.common_margin'), + right: $r('app.float.common_margin') + }) + + Row() { + Search({ placeholder: $r('app.string.search_placeholder') }) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.None : Visibility.Visible) + .enableKeyboardOnFocus(false) + .placeholderColor($r('sys.color.mask_secondary')) + .borderColor($r('app.color.five_percent_white_fund')) + .searchIcon({ + color: $r('sys.color.mask_secondary') + }) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.search_width_sm') : $r('app.float.search_width')) + .margin({ + left: $r('app.float.common_margin'), + right: $r('app.float.common_margin') + }) + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.title_padding_tb'), + bottom: $r('app.float.title_padding_tb') + }) + .margin({ + top: this.topHeight + }) + } + + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Scroll() { + Column() { + this.buildMyFundingInfo() + + this.buildSwiperButton() + + this.buildSteadyGrowth() + + Column() { + Row() { + Image($r('app.media.ic_pursue_profit')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.pursue_profit')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.pursue_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.pursue_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + Row({ space: FundConstants.TAB_ROW_SPACE }) { + this.buildTabBarText($r('app.string.common_stock'), 0) + this.buildTabBarText($r('app.string.partial_stock_mix'), 1) + this.buildTabBarText($r('app.string.flexible_configuration'), 2) + this.buildTabBarText($r('app.string.index_funds'), 3) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent(){ + Row() { + // [EndExclude fund_component] + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(0, 2), + md: FundingViewModel.getAllFundInfo(0, 4), + lg: FundingViewModel.getAllFundInfo(0, 6) + }).getValue(this.currentPoint), (item: FundDetail) => { + ListItem() { + Row() { + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + .margin({ + left: $r('app.float.margin_text_left') + }) + } + .justifyContent(FlexAlign.SpaceAround) + } + }) + } + .lanes(new BreakpointUtil({ + sm: 1, + md: 2, + lg: 3 + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + // [StartExclude fund_component] + .scrollBar(BarState.Off) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(VerticalAlign.Top) + } + .tabBar($r('app.string.common_stock')) + TabContent(){ + } + .tabBar($r('app.string.partial_stock_mix')) + TabContent(){ + } + .tabBar($r('app.string.flexible_configuration')) + TabContent(){ + } + .tabBar($r('app.string.index_funds')) + } + .barHeight(0) + .scrollable(false) + .barMode(BarMode.Scrollable) + .barWidth(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.profit_tab_height')) + } + .backgroundColor(Color.White) + .padding($r('app.float.bottom_padding')) + .margin({ + top: $r('app.float.bottom_margin_top') + }) + } + } + .scrollBar(BarState.Off) + } + .margin({ + top: $r('app.float.scroll_margin_top'), + bottom: this.bottom + }) + } + .backgroundColor($r('app.color.common_background')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + + @Builder + buildTabBarText(text: ResourceStr, index: number) { + Text(text) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === index ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = index; + this.controller.changeIndex(this.tabBarIndex); + }) + } + + @Builder + buildSteadyGrowth() { + Column() { + Row() { + Image($r('app.media.ic_steady_growth')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.steady_growth')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.steady_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.steady_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_SM), + md: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_MD), + lg: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_LG) + }).getValue(this.currentPoint), (item: FundDetail, index: number) => { + ListItem() { + Column() { + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.year_text_size')) + .fontColor($r('app.color.forty_percent_white')) + } + .height($r('app.float.list_item_height')) + .width($r('app.float.list_item_width')) + .justifyContent(FlexAlign.SpaceAround) + .onClick(() => { + this.pageIndexInfos.pushPathByName(RouterConstants.FUNDING_DETAIL_URL, + { 'listIndex': index } as Record); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + }) + } + .lanes(new BreakpointUtil({ + sm: FundConstants.LIST_LANES_SM, + md: FundConstants.LIST_LANES_MD, + lg: FundConstants.LIST_LANES_LG + }).getValue(this.currentPoint), + this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.list_space_sm') : $r('app.float.list_space')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.common_margin'), + bottom: $r('app.float.list_margin_bottom') + }) + } + .backgroundColor(Color.White) + .padding($r('app.float.list_padding')) + } + + @Builder + buildSwiperButton() { + Swiper() { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_MD), + lg: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + if (this.currentPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_MD) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_MD) + }).getValue(this.currentPoint), () => { + Column() { + } + .width($r('app.float.column_swiper_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + } + } + .height(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.swiper_build_height_lg') : $r('app.float.swiper_build_height')) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_LG ? false : true) + .margin({ + top: $r('app.float.swiper_build_margin_top') + }) + } + + @Builder + buildMyFundingInfo() { + Column() { + Column() { + Column() { + Row() { + Text($r('app.string.my_funding')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + Row() { + Text($r('app.string.my_concern')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + .margin({ + right: $r('app.float.concern_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_width')) + .height($r('app.float.common_image')) + .fillColor(Color.White) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Text($r('app.string.my_amount')) + .fontSize($r('app.float.amount_text_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + .margin({ + top: $r('app.float.amount_margin_top') + }) + } + .alignItems(HorizontalAlign.Start) + + Row() { + Image($r('app.media.ic_public_sound')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor($r('app.color.sixty_percent_black')) + Text($r('app.string.funding_news')) + .fontSize($r('app.float.news_text_size')) + .fontColor($r('sys.color.font_on_secondary')) + .fontWeight(FontWeight.Normal) + .textOverflow({ + overflow: TextOverflow.Ellipsis + }) + .maxLines(1) + .layoutWeight(1) + .margin({ + left: $r('app.float.sixty_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundImage($r('app.media.ic_fund_background')) + .backgroundImageSize({ + width: $r('app.float.ic_background_image_width'), + height: $r('app.float.ic_background_image_height') + }) + .backgroundImagePosition({ + x: this.backgroundX, + y: this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.ic_background_position_lg') : $r('app.float.ic_background_position') + }) + .padding({ + top: $r('app.float.padding_common'), + bottom: $r('app.float.info_padding_bottom'), + left: new BreakpointUtil({ + sm: $r('app.float.info_padding_left'), + md: $r('app.float.padding_common'), + lg: $r('app.float.padding_common') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.info_padding_right_sm'), + md: $r('app.float.info_padding_right_md'), + lg: $r('app.float.info_padding_right_lg') + }).getValue(this.currentPoint) + }) + } + .height($r('app.float.funding_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .linearGradient({ + direction: GradientDirection.Right, + colors: [['#0954EA', 0], ['#6193F6', 0.91], ['#88AFFC', 1]] + }) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.info_radius')) + .onAreaChange((oldVale: Area, newVale: Area) => { + let width = newVale.width; + if (typeof width === 'number') { + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.backgroundX = width - FundConstants.CALCULATE_POSITION_LG; + } else { + this.backgroundX = width - FundConstants.CALCULATE_POSITION; + } + } + this.backgroundX = vp2px(this.backgroundX) + }) + } + // [EndExclude fund_component] +} +// [End fund_component] \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/FundNavigationComponent.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/FundNavigationComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..7eee6a4bd841835e6b58f6a99e659a2802b19c3a --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/FundNavigationComponent.ets @@ -0,0 +1,475 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail } from '@ohos/basic'; +import { FundConstants } from '../constants/FundConstants'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Component +export struct FundNavigationComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State listIndex: number = 0; + @State tabBarIndex: number = 0; + @State backgroundX: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + + build() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + Search({ placeholder: $r('app.string.search_placeholder') }) + .enableKeyboardOnFocus(false) + .placeholderColor($r('app.color.sixty_percent_white')) + .borderColor($r('app.color.five_percent_white_fund')) + .searchIcon({ + color: $r('app.color.sixty_percent_white') + }) + .layoutWeight(1) + .margin({ + left: $r('app.float.common_margin'), + right: $r('app.float.common_margin') + }) + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.title_padding_tb'), + bottom: $r('app.float.title_padding_tb') + }) + } + + GridCol({ + span: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Scroll() { + Column() { + this.buildMyFundingInfo() + + this.buildSwiperButton() + + this.buildSteadyGrowth() + + Column() { + Row() { + Image($r('app.media.ic_pursue_profit')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.pursue_profit')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.pursue_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.pursue_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + this.buildTabBarText($r('app.string.common_stock'), 0) + this.buildTabBarText($r('app.string.partial_stock_mix'), 1) + this.buildTabBarText($r('app.string.flexible_configuration'), 2) + this.buildTabBarText($r('app.string.index_funds'), 3) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent(){ + Row() { + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(0, 2), + md: FundingViewModel.getAllFundInfo(0, 4), + lg: FundingViewModel.getAllFundInfo(0, 6) + }).getValue(this.currentPoint), (item: FundDetail) => { + ListItem() { + Row() { + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + .margin({ + left: $r('app.float.margin_text_left') + }) + } + .justifyContent(FlexAlign.SpaceAround) + } + }) + } + .lanes(new BreakpointUtil({ + sm: 1, + md: 2, + lg: 3 + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .scrollBar(BarState.Off) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(VerticalAlign.Top) + } + .tabBar($r('app.string.common_stock')) + TabContent(){ + } + .tabBar($r('app.string.partial_stock_mix')) + TabContent(){ + } + .tabBar($r('app.string.flexible_configuration')) + TabContent(){ + } + .tabBar($r('app.string.index_funds')) + } + .barHeight(0) + .scrollable(false) + .barMode(BarMode.Scrollable) + .barWidth(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.profit_tab_height')) + } + .backgroundColor(Color.White) + .padding($r('app.float.bottom_padding')) + .margin({ + top: $r('app.float.bottom_margin_top') + }) + } + } + .scrollBar(BarState.Off) + .margin({ + top: $r('app.float.scroll_margin_top') + }) + } + } + .backgroundColor($r('app.color.common_background')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + if (breakpoints === CommonConstants.BREAK_POINT_XS) { + this.currentPoint = CommonConstants.BREAK_POINT_SM + } + }) + } + + @Builder + buildTabBarText(text: ResourceStr, index: number) { + Text(text) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === index ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = index; + this.controller.changeIndex(this.tabBarIndex); + }) + } + + @Builder + buildSteadyGrowth() { + Column() { + Row() { + Image($r('app.media.ic_steady_growth')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.steady_growth')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.steady_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.steady_margin_left') + }); + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_SM), + md: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_MD), + lg: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_LG) + }).getValue(this.currentPoint), (item: FundDetail, index: number) => { + ListItem() { + Column() { + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI); + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700); + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.year_text_size')) + .fontColor($r('app.color.forty_percent_white')); + } + .height($r('app.float.list_item_height')) + .width($r('app.float.list_item_width')) + .justifyContent(FlexAlign.SpaceAround) + .onClick(() => { + this.pageInfo.pushPathByName(CommonConstants.PATH_DETAIL, index); + this.listIndex = index; + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(this.listIndex === index ? $r('app.color.list_background') : Color.White) + }, (item: FundDetail, index: number) => index + JSON.stringify(item)) + } + .lanes(new BreakpointUtil({ + sm: FundConstants.LIST_LANES_SM, + md: FundConstants.LIST_LANES_MD, + lg: FundConstants.LIST_LANES_LG + }).getValue(this.currentPoint), + this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.list_space_sm') : $r('app.float.list_space')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.common_margin'), + bottom: $r('app.float.list_margin_bottom') + }) + } + .backgroundColor(Color.White) + .padding($r('app.float.list_padding')) + } + + @Builder + buildSwiperButton() { + Swiper() { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_MD), + lg: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top); + if (this.currentPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_MD) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + }; + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_MD) + }).getValue(this.currentPoint), () => { + Column() { + } + .width($r('app.float.column_swiper_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + } + } + .height(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.swiper_build_height_lg') : $r('app.float.swiper_build_height')) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_LG ? false : true) + .margin({ + top: $r('app.float.swiper_build_margin_top') + }) + } + + @Builder + buildMyFundingInfo() { + Column() { + Column() { + Column() { + Row() { + Text($r('app.string.my_funding')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + Row() { + Text($r('app.string.my_concern')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + .margin({ + right: $r('app.float.concern_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_width')) + .height($r('app.float.common_image')) + .fillColor(Color.White); + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT); + + Text($r('app.string.my_amount')) + .fontSize($r('app.float.amount_text_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + .margin({ + top: $r('app.float.amount_margin_top') + }) + } + .alignItems(HorizontalAlign.Start) + + Row() { + Image($r('app.media.ic_public_sound')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor($r('app.color.sixty_percent_black')) + Text($r('app.string.funding_news')) + .fontSize($r('app.float.news_text_size')) + .fontColor($r('app.color.sixty_percent_black')) + .fontWeight(FontWeight.Normal) + .textOverflow({ + overflow: TextOverflow.Ellipsis + }) + .maxLines(1) + .layoutWeight(1) + .margin({ + left: $r('app.float.sixty_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundImage($r('app.media.ic_fund_background')) + .backgroundImageSize({ + width: $r('app.float.ic_background_image_width'), + height: $r('app.float.ic_background_image_height') + }) + .backgroundImagePosition({ + x: this.backgroundX, + y: $r('app.float.ic_background_position_lg') + }) + .padding({ + top: $r('app.float.padding_common'), + bottom: $r('app.float.info_padding_bottom'), + left: new BreakpointUtil({ + sm: $r('app.float.info_padding_left'), + md: $r('app.float.padding_common'), + lg: $r('app.float.padding_common') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.info_padding_right_sm'), + md: $r('app.float.info_padding_right_md'), + lg: $r('app.float.info_padding_right_lg') + }).getValue(this.currentPoint) + }) + } + .height($r('app.float.funding_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .linearGradient({ + direction: GradientDirection.Right, + colors: [['#0954EA', 0], ['#6193F6', 0.91], ['#88AFFC', 1]] + }) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.info_radius')) + .onAreaChange((oldVale: Area, newVale: Area) => { + let width = newVale.width; + if (typeof width === 'number') { + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.backgroundX = width - FundConstants.CALCULATE_POSITION_LG; + } else { + this.backgroundX = width - FundConstants.CALCULATE_POSITION; + } + } + this.backgroundX = vp2px(this.backgroundX) + }) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/Funding.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/Funding.ets new file mode 100644 index 0000000000000000000000000000000000000000..6157f9603ad95689dde79e0ad96f3a5907523cd8 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/Funding.ets @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '@ohos/basic/'; +import { window } from '@kit.ArkUI'; +import { FundConstants } from '../constants/FundConstants'; +import { FundComponent } from './FundComponent'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Component +export struct Funding { + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + @State currentTabIndex: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + Text(title) + .fontSize($r('app.float.home_tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(title) + .fontSize($r('app.float.home_tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + } + } + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + FundComponent() + } + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) + } + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.TAB_HEIGHT_PERCENT : 0) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) + } + } + } + } + .hideTitleBar(true) + .onWillShow(() => { + AppStorage.setOrCreate('allFund', FundingViewModel.getAllFundInfo()); + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#FFFFFF' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#00ffffff' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/FundingDetail.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/FundingDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8f67056f68328d0730aa9a2d1cb9b511412a69a --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/FundingDetail.ets @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '@ohos/basic/'; +import { ComparisonComponent, ComparisonInfo, ComparisonDetailComponent } from '@ohos/fundComparison/'; +import { TransactionComponent } from '@ohos/transaction/'; +import { FundConstants } from '../constants/FundConstants'; +import { DetailComponent } from './DetailComponent'; +import { FundNavigationComponent } from './FundNavigationComponent'; + +@Component +export struct FundingDetail { + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + @State currentTabIndex: number = 0; + @State index: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + // [Start funding_detail] + Navigation(this.pageInfo) { + FundNavigationComponent({ listIndex: this.index }) + } + .navDestination(this.buildNavDestination) + .hideTitleBar(true) + .hideBackButton(true) + .mode(this.breakPoint === CommonConstants.BREAK_POINT_LG ? NavigationMode.Split : NavigationMode.Stack) + .navBarWidth(FundConstants.NAV_BAR_WIDTH) + // [End funding_detail] + } + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) + } + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.TAB_HEIGHT_PERCENT : 0) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) + } + } + } + } + .hideTitleBar(true) + .onWillAppear(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_DETAIL, param: this.index }, false); + }) + .margin({ + top: this.topHeight, + bottom: this.bottom + }) + } + // [Start build_nav_destination] + @Builder + buildNavDestination(name: string, param: object) { + if (name === CommonConstants.PATH_DETAIL) { + if (typeof param === 'number') { + DetailComponent({ indexList: param }) + } + } else if (name === CommonConstants.PATH_COMPARISON) { + ComparisonComponent() + } else if (name === CommonConstants.PATH_COMPARISON_DETAIL) { + NavDestination() { + ComparisonDetailComponent({ chooseComparison: (param as ComparisonInfo[]) }) + } + .hideTitleBar(true) + } else if (name === CommonConstants.PATH_BUYING) { + if (typeof param === 'number') { + TransactionComponent({ indexList: param }) + } + } + } + // [End build_nav_destination] + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + Text(title) + .fontSize($r('app.float.home_tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(title) + .fontSize($r('app.float.home_tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) + } + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/view/TrendsPage.ets b/MultiFinancialManagement/features/fund/src/main/ets/view/TrendsPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..4033a3585863553294560dd252e963995938171d --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/view/TrendsPage.ets @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Callback } from '@kit.BasicServicesKit'; +import { display } from '@kit.ArkUI'; +import { window } from '@kit.ArkUI'; +import { LineChart, LineChartModel } from '@ohos/mpchart'; +import { BreakpointUtil, CommonConstants, logger } from '@ohos/basic/'; +import ChartViewModel from '../viewmodel/ChartViewModel'; +import { ChartLegendComponent } from './ChartLegendComponent'; +import { FundConstants } from '../constants/FundConstants'; + +@Component +export struct TrendsPage { + @State showChart: boolean = true; + @State lineChartModel: LineChartModel = ChartViewModel.getLineChartModel(); + @State tabBarIndex: number = 0; + @State name: string = ''; + @State currentPoint: string = CommonConstants.BREAK_POINT_MD; + @StorageProp('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_MD; + @StorageProp('avoidArea') areaLeft: number = 0; + @State isLandScape: boolean = false; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + private callback: Callback = (data: display.FoldDisplayMode) => { + if (this.isLandScape && data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.PORTRAIT); + }); + } + if (data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_MAIN) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.LANDSCAPE) + }); + this.isLandScape = true; + } + }; + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Row() { + Row() { + Text(this.name) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.name_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.funding_code')) + .fontSize($r('app.float.code_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + left: $r('app.float.code_margin_left') + }) + } + .alignItems(VerticalAlign.Bottom) + + Image($r('app.media.ic_public_reduce')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Text($r('app.string.performance_trends')) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.unit_net_value')) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 1; + this.controller.changeIndex(this.tabBarIndex); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .margin({ + bottom: $r('app.float.tab_bar_top') + }) + .height($r('app.float.title_height')) + + Tabs({ controller: this.controller }) { + TabContent() { + Column() { + Row() { + ChartLegendComponent({ + name: $r('app.string.the_fund'), + color: $r('app.color.fund_chart'), + value: $r('app.string.the_fund_value') + }) + ChartLegendComponent({ + name: $r('app.string.same_average'), + color: $r('app.color.same_average_chart'), + value: $r('app.string.same_average_value') + }) + ChartLegendComponent({ + name: $r('app.string.other_funding'), + color: $r('app.color.other_funding_chart'), + value: $r('app.string.other_funding_value') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: new BreakpointUtil({ + sm: $r('app.float.legend_padding_lr'), + md: $r('app.float.legend_padding_lr'), + lg: $r('app.float.legend_padding_lr_lg') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.legend_padding_lr'), + md: $r('app.float.legend_padding_lr'), + lg: $r('app.float.legend_padding_lr_lg') + }).getValue(this.currentPoint) + }) + + Row() { + if (this.showChart) { + LineChart({ model: this.lineChartModel }) + } else { + LineChart({ model: this.lineChartModel }) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .layoutWeight(1) + .onAreaChange(() => { + this.lineChartModel = ChartViewModel.getLineChartModel(); + this.showChart = !this.showChart; + }) + + Row() { + Button($r('app.string.near_month', 1)) + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.harmony_blue')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor($r('app.color.five_percent_white_fund')) + .height($r('app.float.chart_button_height')) + .width(new BreakpointUtil({ + sm: $r('app.float.near_button_width'), + md: $r('app.float.near_button_width'), + lg: $r('app.float.near_button_width_lg') + }).getValue(this.currentPoint)) + Button($r('app.string.near_month', 3)) + .chartButtonStyle() + Button($r('app.string.near_month', 6)) + .chartButtonStyle() + Button($r('app.string.near_year', 1)) + .chartButtonStyle() + Button($r('app.string.near_year', 3)) + .chartButtonStyle() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.chart_button_margin') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .tabBar($r('app.string.performance_trends')) + + TabContent() { + + } + .tabBar($r('app.string.unit_net_value')) + } + .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_margin') }) + .barHeight(0) + .scrollable(false) + .layoutWeight(1) + .focusable(false) + } + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .padding({ + left: $r('app.float.padding_common'), + right: this.isLandScape ? this.areaLeft : $r('app.float.padding_common'), + bottom: $r('app.float.padding_common'), + top: this.currentPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.trends_padding_top') : 0 + }) + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + .hideTitleBar(true) + .onAppear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + if (!this.isLandScape && this.breakPoint === CommonConstants.BREAK_POINT_SM) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.LANDSCAPE); + this.isLandScape = true; + }); + } + try { + display.on('foldDisplayModeChange', this.callback); + } catch (exception) { + logger.error('Failed to register callback. Code: ' + JSON.stringify(exception)); + } + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + if (this.isLandScape) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.PORTRAIT); + }); + this.isLandScape = false; + } + try { + display.off('foldDisplayModeChange', this.callback); + } catch (exception) { + logger.error('Failed to register callback. Code: ' + JSON.stringify(exception)); + } + }) + } +} + +@Extend(Button) +function chartButtonStyle() { + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.sixty_percent_white')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor(Color.White) + .height($r('app.float.chart_button_height')) + .constraintSize({ + minWidth: $r('app.float.chart_button_min_width'), + maxWidth: $r('app.float.chart_button_max_width') + }) +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets new file mode 100644 index 0000000000000000000000000000000000000000..e488755edbed65c0029605a09e46ee3fde08bd46 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HashMap } from '@kit.ArkTS'; +import { AxisBase, IAxisValueFormatter } from '@ohos/mpchart'; + +export class ChartAxisFormatter implements IAxisValueFormatter { + xAxis: HashMap = new HashMap(); + + constructor(xAxis: HashMap) { + this.xAxis = xAxis; + } + + public getFormattedValue(value: number, axis: AxisBase): string { + let xAxis = this.xAxis.get(value); + if (xAxis) { + return xAxis; + } + return ''; + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..60d22c3957a08c5e42e39735b02d4056d5c57559 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HashMap } from '@kit.ArkTS'; +import { EntryOhos, ILineDataSet, JArrayList, LineChartModel, LineData, LineDataSet, XAxis, XAxisPosition, + YAxis, AxisDependency, YAxisLabelPosition, + ChartColorStop, + Legend, + Description +} from '@ohos/mpchart'; +import { ChartAxisFormatter } from './ChartAxisFormatter'; + +class ChartViewModel { + xAxis: XAxis | null = null; + topAxis: XAxis | null = null; + mWidth: number = 312; + mHeight: number = 200; + minOffset: number = 30; + leftAxis: YAxis | null = null; + rightAxis: YAxis | null = null; + lineData: LineData | null = null; + lineChartModel: LineChartModel = new LineChartModel(); + maxValue: number = 0; + minValue: number = 0; + + public constructor() { + this.lineData = this.initCurveData(45); + } + + /** + * Init data. + * + * @param count Init data count. + */ + private initCurveData(count: number): LineData { + let values = this.initRandomValue(count); + + let gradientFillColor = new JArrayList(); + gradientFillColor.add(['#661f69ff', 0.1]) + gradientFillColor.add(['#00eff6ff', 1.0]) + + let dataSet = new JArrayList(); + + let set1 = new LineDataSet(values, '本基金'); + set1.setDrawFilled(true); + set1.setDrawValues(false); + set1.setGradientFillColor(gradientFillColor); + set1.setColorByColor(0x0A59F7); + set1.setLineWidth(1) + set1.setDrawCircles(false); + set1.setDrawHorizontalHighlightIndicator(false) + set1.setDrawVerticalHighlightIndicator(false) + dataSet.add(set1); + + let average = this.initRandomValue(count); + let set2 = new LineDataSet(average, '同类平均'); + set2.setDrawFilled(false); + set2.setDrawValues(false); + set2.setColorByColor(0x660A59F7); + set2.setLineWidth(1) + set2.setDrawCircles(false); + // set2.setShowFillLine(false) + dataSet.add(set2); + + let other = this.initRandomValue(count); + let set3 = new LineDataSet(other, '沪深300'); + set3.setDrawFilled(false); + set3.setDrawValues(false); + set3.setColorByColor(0xE84026); + set3.setLineWidth(1) + set3.setDrawCircles(false); + dataSet.add(set3); + + return new LineData(dataSet) + } + + /** + * Randomly generate data. + * + * @param count Init data count. + * @returns JArrayList. + */ + initRandomValue(count: number): JArrayList { + let values = new JArrayList(); + values.add(new EntryOhos(0, 0)); + let temp = 0; + for (let i = 1; i < count; i++) { + let val: number = Math.random() * 0.5; + let calculated: number = Math.random() * 100; + if (calculated > 50) { + temp += val; + values.add(new EntryOhos(i, temp)); + } else { + temp -= val; + values.add(new EntryOhos(i, temp)); + } + if (this.maxValue < temp) { + this.maxValue = temp; + } + if (this.minValue > temp) { + this.minValue = temp; + } + } + return values; + } + + /** + * Get LineChartModel. + * + * @param width + * @param height + * @returns LineChartModel + */ + getLineChartModel(): LineChartModel { + this.lineChartModel = new LineChartModel(); + this.xAxis = this.lineChartModel.getXAxis(); + if (this.xAxis) { + this.xAxis.setLabelCount(3, true); + this.xAxis.setPosition(XAxisPosition.BOTTOM); + this.xAxis.setAxisMinimum(0); + this.xAxis.setAxisMaximum(44); + this.xAxis.setAvoidFirstLastClipping(true); + this.xAxis.setDrawGridLines(false) + let xMap: HashMap = new HashMap(); + xMap.set(0, '07-14'); + xMap.set(22, '08-01'); + xMap.set(44, '08-16'); + this.xAxis.setValueFormatter(new ChartAxisFormatter(xMap)) + } + + this.leftAxis = this.lineChartModel.getAxisLeft(); + if (this.leftAxis) { + let maxy = Math.ceil(this.maxValue); + let miny = Math.floor(this.minValue) + this.leftAxis.setLabelCount(maxy - miny + 1, false); + this.leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART); + this.leftAxis.setSpaceTop(15); + this.leftAxis.setAxisMaximum(maxy); + this.leftAxis.setAxisMinimum(miny); + this.leftAxis.setDrawGridLines(false); + this.leftAxis.setDrawAxisLine(true); + let yMap: HashMap = new HashMap(); + for (let i = miny; i <= maxy; i++) { + yMap.set(i, i + '.00%'); + } + this.leftAxis.setValueFormatter(new ChartAxisFormatter(yMap)) + } + + this.rightAxis = this.lineChartModel.getAxisRight(); + if (this.rightAxis) { + this.rightAxis.setDrawGridLines(false); + this.rightAxis.setDrawAxisLine(false); + this.rightAxis.setDrawLabels(false); + } + + let legend: Legend | null = this.lineChartModel.getLegend(); + if (legend) { + legend.setEnabled(false); + } + let description: Description | null = this.lineChartModel.getDescription(); + if (description) { + description.setEnabled(false); + } + + this.lineChartModel.setMinOffset(2); + this.lineChartModel.setHighlightPerLongPressEnabled(false); + this.lineChartModel.setData(this.lineData); + return this.lineChartModel; + } +} + +export default new ChartViewModel(); \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/FundingViewModel.ets b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/FundingViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..a36648e9a939543671322d69ba5e20c326034b31 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/FundingViewModel.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BusinessInfo, FundDetail } from '@ohos/basic'; + +/** + * Get fund data. + */ +class FundingViewModel { + getFundingButtonBusiness(start: number, end?: number): BusinessInfo[] { + let fundingBusinessInfoList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_ranking'), $r('app.string.funding_ranking')), + new BusinessInfo($r('app.media.ic_index_zone'), $r('app.string.funding_index_zone')), + new BusinessInfo($r('app.media.ic_fixed_investment'), $r('app.string.fixed_investment')), + new BusinessInfo($r('app.media.ic_public_Investment_star'), $r('app.string.investment_star_selection')), + new BusinessInfo($r('app.media.ic_good_chance'), $r('app.string.funding_good_chance')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')) + ]; + return fundingBusinessInfoList.slice(start, end); + } + + getAllFundInfo(start?: number, end?: number): FundDetail[] { + let fundInfoList: FundDetail[] = [ + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_industrial'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_mixed_currency'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_bonds'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')) + ]; + return fundInfoList.slice(start, end); + } +} + +export default new FundingViewModel(); \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/module.json5 b/MultiFinancialManagement/features/fund/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c023333804df678c4d8c5252057fa20b638818a3 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "fund", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/element/color.json b/MultiFinancialManagement/features/fund/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..38c6f302bc9a1b37b819666e4e4babf1a9ddc78a --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/element/color.json @@ -0,0 +1,128 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0dffffff" + }, + { + "name": "five_percent_white_fund", + "value": "#0d000000" + }, + { + "name": "sixty_percent_black", + "value": "#99ffffff" + }, + { + "name": "sixty_percent_white", + "value": "#99000000" + }, + { + "name": "forty_percent_white", + "value": "#66000000" + }, + { + "name": "ten_percent_white", + "value": "#1a000000" + }, + { + "name": "harmony_blue", + "value": "#0A59F7" + }, + { + "name": "name_text", + "value": "#182431" + }, + { + "name": "currency_font", + "value": "#1F69FF" + }, + { + "name": "currency_border", + "value": "#1F69FF" + }, + { + "name": "amplitude_text", + "value": "#E84026" + }, + { + "name": "amplitude_date", + "value": "#28AD2B" + }, + { + "name": "fund_chart", + "value": "#0A59F7" + }, + { + "name": "same_average_chart", + "value": "#660a59f7" + }, + { + "name": "other_funding_chart", + "value": "#E84026" + }, + { + "name": "bottom_button", + "value": "#0A59F7" + }, + { + "name": "common_background", + "value": "#F7F7F7" + }, + { + "name": "name_build_text", + "value": "#cc000000" + }, + { + "name": "value_build_text", + "value": "#28AD2B" + }, + { + "name": "pursue_text", + "value": "#182431" + }, + { + "name": "steady_font", + "value": "#182431" + }, + { + "name": "amplitude_text_font", + "value": "#E84026" + }, + { + "name": "list_background", + "value": "#0d1f69ff" + }, + { + "name": "transparent_color", + "value": "#00000000" + }, + { + "name": "gradient_left", + "value": "#0954EA" + }, + { + "name": "gradient_center", + "value": "#6193F6" + }, + { + "name": "gradient_right", + "value": "#88AFFC" + }, + { + "name": "tab_choose_image", + "value": "#0A59F7" + }, + { + "name": "tab_un_image", + "value": "#33000000" + }, + { + "name": "home_background", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/element/float.json b/MultiFinancialManagement/features/fund/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..bbc471cee206bf6a96993754ff8948a2f4271715 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/element/float.json @@ -0,0 +1,420 @@ +{ + "float": [ + { + "name": "nav_bar_width", + "value": "474vp" + }, + { + "name": "common_image", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "common_margin", + "value": "24vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "common_font_size", + "value": "16fp" + }, + { + "name": "common_divider", + "value": "1vp" + }, + { + "name": "title_text_size", + "value": "18fp" + }, + { + "name": "title_height", + "value": "56vp" + }, + { + "name": "code_size", + "value": "12fp" + }, + { + "name": "currency_size", + "value": "10fp" + }, + { + "name": "currency_border_radius", + "value": "4vp" + }, + { + "name": "currency_padding_tb", + "value": "1vp" + }, + { + "name": "currency_padding_lr", + "value": "4vp" + }, + { + "name": "type_margin_top", + "value": "13vp" + }, + { + "name": "type_margin_bottom", + "value": "24vp" + }, + { + "name": "amplitude_size", + "value": "24fp" + }, + { + "name": "amplitude_time_size", + "value": "12fp" + }, + { + "name": "amplitude_date_size", + "value": "18fp" + }, + { + "name": "value_size", + "value": "12fp" + }, + { + "name": "last_net_margin_left", + "value": "16vp" + }, + { + "name": "last_net_margin_tb", + "value": "16vp" + }, + { + "name": "rating_margin_right", + "value": "18vp" + }, + { + "name": "rating_height", + "value": "12vp" + }, + { + "name": "scroll_column_padding_right", + "value": "56vp" + }, + { + "name": "scroll_column_padding_top", + "value": "13vp" + }, + { + "name": "scroll_column_padding_bottom", + "value": "16vp" + }, + { + "name": "scroll_column_margin", + "value": "12vp" + }, + { + "name": "chart_button_size", + "value": "12fp" + }, + { + "name": "chart_button_height", + "value": "28vp" + }, + { + "name": "chart_button_min_width", + "value": "64vp" + }, + { + "name": "chart_button_max_width", + "value": "150vp" + }, + { + "name": "chart_button_margin", + "value": "12vp" + }, + { + "name": "tab_bar_margin", + "value": "0vp" + }, + { + "name": "image_enlarge_margin", + "value": "16vp" + }, + { + "name": "chart_height", + "value": "359vp" + }, + { + "name": "contrasts_size", + "value": "12fp" + }, + { + "name": "bottom_button_width", + "value": "84vp" + }, + { + "name": "bottom_button_height", + "value": "40vp" + }, + { + "name": "bottom_padding_tb", + "value": "14vp" + }, + { + "name": "text_name_size", + "value": "12fp" + }, + { + "name": "build_divider_width", + "value": "16vp" + }, + { + "name": "build_divider_height", + "value": "2vp" + }, + { + "name": "build_divider_radius", + "value": "1vp" + }, + { + "name": "build_divider_margin_left", + "value": "8vp" + }, + { + "name": "value_build_text_size", + "value": "14fp" + }, + { + "name": "title_padding_tb", + "value": "8vp" + }, + { + "name": "pursue_margin_left", + "value": "12vp" + }, + { + "name": "bottom_padding", + "value": "12vp" + }, + { + "name": "bottom_margin_top", + "value": "12vp" + }, + { + "name": "scroll_margin_top", + "value": "16vp" + }, + { + "name": "steady_margin_left", + "value": "12vp" + }, + { + "name": "amplitude_text_size", + "value": "24fp" + }, + { + "name": "year_text_size", + "value": "12fp" + }, + { + "name": "list_item_height", + "value": "99vp" + }, + { + "name": "list_item_width", + "value": "140vp" + }, + { + "name": "list_space_sm", + "value": "12vp" + }, + { + "name": "list_space", + "value": "16vp" + }, + { + "name": "list_margin_bottom", + "value": "16vp" + }, + { + "name": "list_padding", + "value": "12vp" + }, + { + "name": "button_text_size", + "value": "12fp" + }, + { + "name": "button_text_margin_top", + "value": "5vp" + }, + { + "name": "swiper_height", + "value": "44vp" + }, + { + "name": "column_swiper_width", + "value": "48vp" + }, + { + "name": "swiper_build_height_lg", + "value": "60vp" + }, + { + "name": "swiper_build_height", + "value": "84vp" + }, + { + "name": "swiper_build_margin_top", + "value": "25vp" + }, + { + "name": "my_fund_size", + "value": "18fp" + }, + { + "name": "concern_margin_right", + "value": "8vp" + }, + { + "name": "arrow_width", + "value": "12vp" + }, + { + "name": "amount_text_size", + "value": "36fp" + }, + { + "name": "amount_margin_top", + "value": "16vp" + }, + { + "name": "news_text_size", + "value": "18fp" + }, + { + "name": "sixty_margin_left", + "value": "12vp" + }, + { + "name": "funding_info_height", + "value": "168vp" + }, + { + "name": "info_radius", + "value": "16vp" + }, + { + "name": "info_padding_left", + "value": "16vp" + }, + { + "name": "info_padding_bottom", + "value": "16vp" + }, + { + "name": "info_padding_right_sm", + "value": "16vp" + }, + { + "name": "info_padding_right_md", + "value": "28vp" + }, + { + "name": "info_padding_right_lg", + "value": "28vp" + }, + { + "name": "code_margin_left", + "value": "10vp" + }, + { + "name": "tab_text_size_fund", + "value": "16fp" + }, + { + "name": "tab_bar_padding_bottom", + "value": "5vp" + }, + { + "name": "tab_bar_border", + "value": "2vp" + }, + { + "name": "tab_bar_top", + "value": "16vp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "search_width_sm", + "value": "248vp" + }, + { + "name": "ic_background_image_width", + "value": "136vp" + }, + { + "name": "ic_background_image_height", + "value": "126vp" + }, + { + "name": "ic_background_position_lg", + "value": "50vp" + }, + { + "name": "ic_background_position", + "value": "100vp" + }, + { + "name": "tab_text_height", + "value": "14vp" + }, + { + "name": "tab_bar_width", + "value": "96vp" + }, + { + "name": "bottom_button_width_md", + "value": "234vp" + }, + { + "name": "margin_text_left", + "value": "16vp" + }, + { + "name": "near_button_width", + "value": "108vp" + }, + { + "name": "near_button_width_lg", + "value": "156vp" + }, + { + "name": "legend_padding_lr", + "value": "96vp" + }, + { + "name": "legend_padding_lr_lg", + "value": "372vp" + }, + { + "name": "tab_bar_height", + "value": "56vp" + }, + { + "name": "trends_padding_top", + "value": "10vp" + }, + { + "name": "profit_tab_height", + "value": "100vp" + }, + { + "name": "home_tab_text_size", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/element/string.json b/MultiFinancialManagement/features/fund/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ea9a0c4e1cf098d98f40d4e4abc8e1c26a2b47e8 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "我的基金 (元)" + }, + { + "name": "my_concern", + "value": "我的关注" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "快来看看大家最近都在购买的基金" + }, + { + "name": "funding_ranking", + "value": "排行榜" + }, + { + "name": "funding_index_zone", + "value": "指数专区" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "investment_star_selection", + "value": "投资星选" + }, + { + "name": "funding_good_chance", + "value": "好机会" + }, + { + "name": "funding_folder_add", + "value": "自建组合" + }, + { + "name": "steady_growth", + "value": "稳健增长" + }, + { + "name": "funding_short_term_B", + "value": "XXX短债基金B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXX产业基金C" + }, + { + "name": "funding_mixed_currency", + "value": "XXX混合货币" + }, + { + "name": "funding_bonds", + "value": "XXX债券A" + }, + { + "name": "one_year_amplitude", + "value": "近一年涨跌幅" + }, + { + "name": "funding_title", + "value": "基金详情" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "货币型" + }, + { + "name": "medium_risk", + "value": "R3-中风险" + }, + { + "name": "purchase_rmb", + "value": "1.00元起购" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "日涨跌幅" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "最新净值" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "三年评级" + }, + { + "name": "the_fund", + "value": "本基金" + }, + { + "name": "same_average", + "value": "同类平均" + }, + { + "name": "other_funding", + "value": "沪深300" + }, + { + "name": "funding_contrasts", + "value": "对比" + }, + { + "name": "funding_concerned", + "value": "关注" + }, + { + "name": "fixed_investment_button", + "value": "定投" + }, + { + "name": "buying_button", + "value": "购买" + }, + { + "name": "performance_trends", + "value": "业绩走势" + }, + { + "name": "unit_net_value", + "value": "单位净值" + }, + { + "name": "near_month", + "value": "near %d month" + }, + { + "name": "near_year", + "value": "near %d year" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "pursue_profit", + "value": "pursue profit" + }, + { + "name": "common_stock", + "value": "common stock" + }, + { + "name": "partial_stock_mix", + "value": "partial stock mix" + }, + { + "name": "flexible_configuration", + "value": "flexible configuration" + }, + { + "name": "index_funds", + "value": "index funds" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fixed_investment.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fixed_investment.png new file mode 100644 index 0000000000000000000000000000000000000000..5d4b97d84d32b69425684a7216b75bb6463f2e76 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fixed_investment.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_folder_add.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_folder_add.png new file mode 100644 index 0000000000000000000000000000000000000000..bb6631536aad96c1bc356a15f5527f522cec568c Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_folder_add.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fund_background.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fund_background.png new file mode 100644 index 0000000000000000000000000000000000000000..c0c6211e815e9faa74b143efd85dc194e0497152 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_fund_background.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_good_chance.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_good_chance.png new file mode 100644 index 0000000000000000000000000000000000000000..b76083f94d88205486337d68e853c6a4f960b781 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_good_chance.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_fortunes.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_fortunes.svg new file mode 100644 index 0000000000000000000000000000000000000000..27236e9117514e1e9fff77ba9278728504735003 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_fortunes.svg @@ -0,0 +1,11 @@ + + + 财富 + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine.svg new file mode 100644 index 0000000000000000000000000000000000000000..62a5b62bce8cbec51c56c1db00f7317e4e9a52be --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..dbeec6ef94878c69058ce80156916747920a5102 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_index_zone.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_index_zone.png new file mode 100644 index 0000000000000000000000000000000000000000..35ff8f5135015abe72e31f6f7e2d34388fcf8786 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_index_zone.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_life_filled.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1aba5b5eb63534290b53c06fe7815720796b052 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_Investment_star.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_Investment_star.png new file mode 100644 index 0000000000000000000000000000000000000000..30ef8aee0887446278666db3879656e1a290fe70 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_Investment_star.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cc0f2ad4fd08ee0b7340c787910fd3723a36b7d --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_back.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..965b18a454a95133c73c7a3b9b917e538c1a217c --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,20 @@ + + + 信用卡 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_collect_fund.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_collect_fund.png new file mode 100644 index 0000000000000000000000000000000000000000..10c63939486ee40e44c4a2b2a47adc2f7d221f17 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_collect_fund.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_comments.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_copy_fund.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_copy_fund.png new file mode 100644 index 0000000000000000000000000000000000000000..0f854dc969dcd1cdd6b14351161ca3ffd85d0a69 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_copy_fund.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_enlarge.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_enlarge.svg new file mode 100644 index 0000000000000000000000000000000000000000..252b8fe5c6424f8d5f2eefaee0f4e410e771235e --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_enlarge.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_enlarge + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_home_filled.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..deb4371a0ec1c00f635cb10894fb3eefcf8a672f --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,20 @@ + + + 首页 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_reduce.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_reduce.svg new file mode 100644 index 0000000000000000000000000000000000000000..142d090e8c48b30f9f694ae2571754ba110f1645 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_reduce.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reduce + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_share.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..516c03c260f5341c1a969a769e9b19648927cf6d --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_sound.svg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_sound.svg new file mode 100644 index 0000000000000000000000000000000000000000..fbe0bc76b4b98f26978f0044fcb96075aeeee8b4 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_public_sound.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_sound + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_pursue_profit.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_pursue_profit.png new file mode 100644 index 0000000000000000000000000000000000000000..a6cbe9c7b2c7f5d646a11af3bafdf893cc825266 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_pursue_profit.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_ranking.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_ranking.png new file mode 100644 index 0000000000000000000000000000000000000000..cc01479c27543073a8b3ed0c8ef1a91348bde102 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_ranking.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_steady_growth.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_steady_growth.png new file mode 100644 index 0000000000000000000000000000000000000000..2826bef629a2bec4bfd7e09014e10faaee118981 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/ic_steady_growth.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/icon.png b/MultiFinancialManagement/features/fund/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/media/setting.jpeg b/MultiFinancialManagement/features/fund/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiFinancialManagement/features/fund/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiFinancialManagement/features/fund/src/main/resources/base/profile/main_pages.json b/MultiFinancialManagement/features/fund/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..9a81b4ef6c19153c2a381ce08dc7e47810411cc7 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,7 @@ +{ + "src": [ + "view/Funding", + "view/FundingDetail", + "view/TrendsPage" + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/en_US/element/string.json b/MultiFinancialManagement/features/fund/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..11df72a8c14f21df8a0ebd7929233236bd201040 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/en_US/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "My fund (RMB)" + }, + { + "name": "my_concern", + "value": "My concern" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "Let's take a look at the funds everyone's buying." + }, + { + "name": "funding_ranking", + "value": "rankings" + }, + { + "name": "funding_index_zone", + "value": "index zone" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "investment_star_selection", + "value": "Investment Star Selection" + }, + { + "name": "funding_good_chance", + "value": "good chance" + }, + { + "name": "funding_folder_add", + "value": "Self-built combination" + }, + { + "name": "steady_growth", + "value": "steady growth" + }, + { + "name": "funding_short_term_B", + "value": "XXXshort-term debt fund B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXXindustrial fund" + }, + { + "name": "funding_mixed_currency", + "value": "XXX Mixed Currency" + }, + { + "name": "funding_bonds", + "value": "XXXBonds" + }, + { + "name": "one_year_amplitude", + "value": "Ups and downs in the past year" + }, + { + "name": "funding_title", + "value": "Fund Details" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "Currency type" + }, + { + "name": "medium_risk", + "value": "R3-Medium risk" + }, + { + "name": "purchase_rmb", + "value": "Purchase from ¥1.00" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "Daily rise and fall" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "Last net value" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "Three-year rating" + }, + { + "name": "the_fund", + "value": "The fund" + }, + { + "name": "same_average", + "value": "Average" + }, + { + "name": "other_funding", + "value": "Shanghai and Shenzhen" + }, + { + "name": "funding_contrasts", + "value": "contrasts" + }, + { + "name": "funding_concerned", + "value": "concerned" + }, + { + "name": "fixed_investment_button", + "value": "fixed investment" + }, + { + "name": "buying_button", + "value": "buying" + }, + { + "name": "performance_trends", + "value": "Performance Trends" + }, + { + "name": "unit_net_value", + "value": "Unit Net Value" + }, + { + "name": "near_month", + "value": "near %d month" + }, + { + "name": "near_year", + "value": "near %d year" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "pursue_profit", + "value": "pursue profit" + }, + { + "name": "index_funds", + "value": "index funds" + }, + { + "name": "common_stock", + "value": "common stock" + }, + { + "name": "partial_stock_mix", + "value": "partial stock mix" + }, + { + "name": "flexible_configuration", + "value": "flexible configuration" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fund/src/main/resources/zh_CN/element/string.json b/MultiFinancialManagement/features/fund/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4ce2de1730879221441bf0489bb00162a06a9db1 --- /dev/null +++ b/MultiFinancialManagement/features/fund/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "我的基金 (元)" + }, + { + "name": "my_concern", + "value": "我的关注" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "快来看看大家最近都在购买的基金" + }, + { + "name": "funding_ranking", + "value": "排行榜" + }, + { + "name": "funding_index_zone", + "value": "指数专区" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "investment_star_selection", + "value": "投资星选" + }, + { + "name": "funding_good_chance", + "value": "好机会" + }, + { + "name": "funding_folder_add", + "value": "自建组合" + }, + { + "name": "steady_growth", + "value": "稳健增长" + }, + { + "name": "funding_short_term_B", + "value": "XXX短债基金B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXX产业基金C" + }, + { + "name": "funding_mixed_currency", + "value": "XXX混合货币" + }, + { + "name": "funding_bonds", + "value": "XXX债券A" + }, + { + "name": "one_year_amplitude", + "value": "近一年涨跌幅" + }, + { + "name": "funding_title", + "value": "基金详情" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "货币型" + }, + { + "name": "medium_risk", + "value": "R3-中风险" + }, + { + "name": "purchase_rmb", + "value": "1.00元起购" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "日涨跌幅" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "最新净值" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "三年评级" + }, + { + "name": "the_fund", + "value": "本基金" + }, + { + "name": "same_average", + "value": "同类平均" + }, + { + "name": "other_funding", + "value": "沪深300" + }, + { + "name": "funding_contrasts", + "value": "对比" + }, + { + "name": "funding_concerned", + "value": "关注" + }, + { + "name": "fixed_investment_button", + "value": "定投" + }, + { + "name": "buying_button", + "value": "购买" + }, + { + "name": "performance_trends", + "value": "业绩走势" + }, + { + "name": "unit_net_value", + "value": "单位净值" + }, + { + "name": "near_month", + "value": "近%d月" + }, + { + "name": "near_year", + "value": "近%d年" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "pursue_profit", + "value": "追求收益" + }, + { + "name": "index_funds", + "value": "指数基金" + }, + { + "name": "common_stock", + "value": "普通股票" + }, + { + "name": "partial_stock_mix", + "value": "偏股混合" + }, + { + "name": "flexible_configuration", + "value": "灵活配置" + }, + { + "name": "tab_bar_home", + "value": "首页" + }, + { + "name": "tab_bar_card", + "value": "信用卡" + }, + { + "name": "tab_bar_fortunes", + "value": "财富" + }, + { + "name": "tab_bar_life", + "value": "生活" + }, + { + "name": "tab_bar_mine", + "value": "我的" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/Index.ets b/MultiFinancialManagement/features/fundComparison/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..81aa5de9d68f96b6eb6f837b0c6b0a3df758a802 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/Index.ets @@ -0,0 +1,4 @@ +export { ComparisonComponent } from './src/main/ets/view/ComparisonComponent'; +export { ComparisonDetailComponent } from './src/main/ets/view/ComparisonDetailComponent'; +export { ComparisonInfo } from './src/main/ets/viewmodel/ComparisonInfo'; +export { ComparisonDetailPage } from './src/main/ets/view/ComparisonDetailPage'; \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/build-profile.json5 b/MultiFinancialManagement/features/fundComparison/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/hvigorfile.ts b/MultiFinancialManagement/features/fundComparison/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/features/fundComparison/obfuscation-rules.txt b/MultiFinancialManagement/features/fundComparison/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/oh-package.json5 b/MultiFinancialManagement/features/fundComparison/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8a449523209cf65ad106f160a50be194917d972d --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "fundcomparison", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d9a43d9ad4e6a674fd9223d1a8cd1ac24f32671 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Fund comparison constants for comparison feature. + */ +export class ComparisonConstants { + /** + * Maximum number of fund comparisons. + */ + static readonly MAX_COMPARISON_FUND_COUNT: number = 10; + + /** + * Column space. + */ + static readonly COLUMN_SPACE: number = 2; + + /** + * List space. + */ + static readonly CHOOSE_LIST_SPACE: number = 12; + + /** + * Row space. + */ + static readonly FUND_NAME_ROW_SPACE: number = 8; +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonComponent.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..87d7bfdbf19271a9e525e3bdf08a7c085b4e3bdd --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonComponent.ets @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TreeMap } from '@kit.ArkTS'; +import { CommonConstants } from '@ohos/basic'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import FundComparisonViewModel from '../viewmodel/FundComparisonViewModel'; +import { ComparisonConstants } from '../constants/ComparisonConstants'; + +@Component +export struct ComparisonComponent { + @StorageLink('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + @State chooseComparison: ComparisonInfo[] = []; + @State map: TreeMap = new TreeMap(); + @State defaultAllComparison: ComparisonInfo[] = FundComparisonViewModel.getFundComparisonList(); + @State indexArray: number[] = []; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + @State tabBarIndex: number = 0; + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + } + .height($r('app.float.title_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + + Row() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + .margin({ + left: $r('app.float.padding_common') + }) + } + Row() { + Search({ placeholder: $r('app.string.search_placeholder') }) + .width($r('app.float.search_width')) + .enableKeyboardOnFocus(false) + .margin({ + right: $r('app.float.padding_common') + }) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + } + } + .height($r('app.float.title_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.None : Visibility.Visible) + + Search({ placeholder: $r('app.string.search_placeholder') }) + .margin({ + top: $r('app.float.search_margin_top') + }) + .enableKeyboardOnFocus(false) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + + Tabs() { + TabContent() { + List() { + ForEach(this.defaultAllComparison, (item: ComparisonInfo, index: number) => { + ListItem() { + Row() { + Checkbox() + .shape(CheckBoxShape.ROUNDED_SQUARE) + .select(this.indexArray.indexOf(index) != -1) + .onChange((value: boolean) => { + if (value) { + this.map.set(index, item); + } else { + this.map.remove(index); + } + this.chooseComparison = Array.from(this.map.values()); + this.indexArray = Array.from(this.map.keys()); + if (this.map.length > ComparisonConstants.MAX_COMPARISON_FUND_COUNT) { + this.map.remove(index); + this.chooseComparison = Array.from(this.map.values()); + this.indexArray = Array.from(this.map.keys()); + return; + } + }) + Column({ space: ComparisonConstants.COLUMN_SPACE }) { + Text(item.name) + .fontSize($r('app.float.name_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .lineHeight($r('app.float.common_line_height')) + Text(item.code) + .fontSize($r('app.float.code_size')) + .fontColor($r('app.color.sixty_percent_white')) + } + .layoutWeight(1) + .border({ + width: { + bottom: $r('app.float.common_border_width') + }, + color: $r('app.color.five_percent_white_fund') + }) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: $r('app.float.list_padding_bottom') + }) + .margin({ + left: $r('app.float.list_margin_left') + }) + } + } + .height($r('app.float.list_item_height_comparison')) + }) + } + .lanes(this.currentPoint === CommonConstants.BREAK_POINT_SM ? 1 : 2) + } + .tabBar($r('app.string.fund_popularity')) + + TabContent() { + + } + .tabBar($r('app.string.self_selected')) + } + .barMode(BarMode.Fixed) + .barWidth($r('app.float.choose_tab_width')) + .layoutWeight(1) + + Row() { + if (this.chooseComparison.length > 0) { + Column() { + Row({ space: ComparisonConstants.CHOOSE_LIST_SPACE }) { + Text($r('app.string.no_currency', this.chooseComparison.length)) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.currency_bar', 0)) + .fontSize($r('app.float.tab_text_size_fund')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .onClick(() => { + this.tabBarIndex = 1; + this.controller.changeIndex(this.tabBarIndex); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ controller: this.controller }) { + TabContent() { + List({ space: ComparisonConstants.CHOOSE_LIST_SPACE }) { + ForEach(this.chooseComparison, (item: ComparisonInfo) => { + ListItem() { + Stack() { + Row() { + Text(item.name) + .fontSize($r('app.float.stack_text_size')) + } + .backgroundColor($r('app.color.five_percent_white_fund')) + .borderRadius($r('app.float.row_border_radius')) + .padding({ + top: $r('app.float.stack_row_padding_top'), + bottom: $r('app.float.stack_row_padding_bottom'), + left: $r('app.float.stack_row_padding_left'), + right: $r('app.float.stack_row_padding_right') + }) + .margin({ + top: $r('app.float.stack_row_margin_top') + }) + Row() { + Image($r('app.media.ic_public_close')) + .width($r('app.float.close_image')) + .height($r('app.float.close_image')) + .fillColor($r('app.color.forty_percent_white')) + .onClick(() => { + for (let i = 0; i < this.defaultAllComparison.length; i++) { + if (item.code === this.defaultAllComparison[i].code) { + this.map.remove(i); + this.indexArray = Array.from(this.map.keys()); + this.chooseComparison = Array.from(this.map.values()); + } + } + }) + } + .layoutWeight(1) + .justifyContent(FlexAlign.End) + .alignItems(VerticalAlign.Top) + } + .align(Alignment.TopEnd) + } + }) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.content_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .tabBar($r('app.string.no_currency', this.chooseComparison.length)) + + TabContent() { + + } + .tabBar($r('app.string.currency_bar', 0)) + } + .layoutWeight(1) + .barHeight(0) + .scrollable(false) + + Row() { + Column() { + Text($r('app.string.count_choose', this.chooseComparison.length)) + .fontSize($r('app.float.choose_count_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.max_count_choose')) + .fontSize($r('app.float.choose_hints_size')) + .lineHeight($r('app.float.choose_hints_lint_height')) + .fontColor($r('app.color.sixty_percent_white')) + } + + Button($r('app.string.start_comparison')) + .backgroundColor($r('app.color.start_button_background')) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.start_button_width_sm') : $r('app.float.start_button_width')) + .height($r('app.float.start_button_height')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .onClick(() => { + this.pageInfo.pushPathByName(CommonConstants.PATH_COMPARISON_DETAIL, this.chooseComparison); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } else { + Row() { + Text($r('app.string.select_fund')) + .fontSize($r('app.float.common_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Button($r('app.string.start_comparison')) + .backgroundColor($r('app.color.start_comparison_background')) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.start_button_width_sm') : $r('app.float.start_button_width')) + .height($r('app.float.start_button_height')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } + .height(this.chooseComparison.length > 0 ? + $r('app.float.bottom_choose_height_show') : $r('app.float.bottom_choose_height')) + } + } + } + .padding({ + left: $r('app.float.comparison_padding_left'), + right: $r('app.float.comparison_padding_right'), + bottom: $r('app.float.comparison_padding_bottom') + }) + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbcc3947771aa4fe232a9236c00a14acefcc5290 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets @@ -0,0 +1,346 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants, RouterConstants } from '@ohos/basic'; +import { ComparisonConstants } from '../constants/ComparisonConstants'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import FundComparisonViewModel from '../viewmodel/FundComparisonViewModel'; + +@Component +export struct ComparisonDetailComponent { + @State chooseComparison: ComparisonInfo[] = FundComparisonViewModel.getFundComparisonList(); + @State isListScroll: boolean = true; + @State isScroll: boolean = true; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State isPage: Boolean = false; + @StorageProp('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private nameColorArr: ResourceColor[] = [ + $r('app.color.name_color_1'), + $r('app.color.name_color_2'), + $r('app.color.name_color_3') + ]; + scroller: Scroller = new Scroller(); + scrollerList: Scroller = new Scroller(); + + build() { + Column() { + Row() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .margin({ + right: $r('app.float.image_margin_right') + }) + .onClick(() => { + if (this.isPage) { + this.pageIndexInfos.pop(); + } else { + this.pageInfo.pop(); + } + }) + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + if (this.isPage) { + Image($r('app.media.ic_public_reduce')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + } else { + Image($r('app.media.ic_public_enlarge')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pushPathByName(RouterConstants.COMPARISON_PAGE_URL, + { 'chooseComparison': this.chooseComparison } as Record); + }) + } + } + } + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + if (this.isPage) { + this.pageIndexInfos.pop(); + } else { + this.pageInfo.pop(); + } + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + top: $r('app.float.title_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Tabs() { + TabContent() { + Column() { + Row() { + Row() { + Text($r('app.string.table_fund_name')) + .fontSize($r('app.float.fund_name_size')) + .lineHeight($r('app.float.fund_name_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + } + .width($r('app.float.fund_name_width')) + .height($r('app.float.fund_name_height')) + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Center) + + List({ space: ComparisonConstants.FUND_NAME_ROW_SPACE, scroller: this.scrollerList }) { + ForEach(this.chooseComparison, (item: ComparisonInfo, index: number) => { + ListItem() { + Column() { + Row() { + Image($r('app.media.ic_fixing')) + .width($r('app.float.fixing_width')) + .height($r('app.float.fixing_height')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.cancel_width')) + .height($r('app.float.cancel_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.fixing_image_padding'), + right: $r('app.float.fixing_image_padding'), + bottom: $r('app.float.fixing_image_padding') + }) + + Row() { + Divider() + .vertical(true) + .width($r('app.float.divider_fixing_width')) + .height($r('app.float.divider_fixing_height')) + .color(this.nameColorArr[index % this.nameColorArr.length]) + .borderRadius($r('app.float.divider_fixing_radius')) + Text(item.name) + .fontSize($r('app.float.list_fund_name_size')) + .lineHeight($r('app.float.list_name_line_height')) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ + left: $r('app.float.list_name_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + } + .width($r('app.float.list_name_width')) + .height($r('app.float.list_name_height')) + .backgroundColor($r('app.color.background')) + .borderRadius($r('app.float.list_name_radius')) + }) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .edgeEffect(EdgeEffect.None) + .onWillScroll((_scrollOffset: number) => { + if (this.isScroll) { + let offset = this.scrollerList.currentOffset().xOffset; + this.scroller.scrollTo({ xOffset: offset, yOffset: 0 }); + } + }) + .onScrollFrameBegin((offset: number) => { + this.isListScroll = false; + return { offsetRemain: offset } + }) + .onScrollStop(() => { + this.isListScroll = true; + }) + .layoutWeight(1) + } + .height($r('app.float.list_name_height')) + + Divider() + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.common_divider')) + .backgroundColor($r('app.color.divider_background')) + .margin({ + top: $r('app.float.divider_margin_top'), + bottom: $r('app.float.divider_margin_bottom') + }) + Text($r('app.string.base_info')) + .fontSize($r('app.float.common_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor($r('app.color.info_text')) + .margin({ + left: $r('app.float.info_margin_left') + }) + Scroll() { + Row() { + List() { + ForEach(FundComparisonViewModel.getComparisonCategory(), (item: ResourceStr) => { + ListItem() { + Text(item) + .fontSize($r('app.float.list_head_size')) + .lineHeight($r('app.float.list_head_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + .width($r('app.float.list_head_text_width')) + } + .height($r('app.float.list_head_height')) + .width($r('app.float.list_head_width')) + }) + } + .border({ + width: { + top: $r('app.float.list_head_border'), + bottom: $r('app.float.list_head_border') + }, + color: $r('app.color.ten_percent_white') + }) + .width($r('app.float.list_head_width')) + .divider({ + strokeWidth: $r('app.float.common_divider'), + color: $r('app.color.ten_percent_white') + }) + + Scroll(this.scroller) { + Row() { + ForEach(this.chooseComparison, (item: ComparisonInfo) => { + List() { + ListItem() { + Text(item.code) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.type) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.establishedTime) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.scale}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.risksLevel) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.rating}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.dividends}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.dividendsCount}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.fundManager) + .buildScrollListText() + } + .listStyle() + } + .divider({ + strokeWidth: $r('app.float.common_divider'), + color: $r('app.color.ten_percent_white') + }) + .width($r('app.float.scroll_list_width')) + .border({ + width: $r('app.float.common_divider'), + color: $r('app.color.ten_percent_white') + }) + }) + } + .justifyContent(FlexAlign.Start) + } + .scrollable(ScrollDirection.Horizontal) + .scrollBar(BarState.Off) + .edgeEffect(EdgeEffect.None) + .onWillScroll((_scrollOffset: number) => { + if (this.isListScroll) { + let offset = this.scroller.currentOffset().xOffset; + this.scrollerList.scrollTo({ xOffset: offset, yOffset: 0 }); + } + }) + .onScrollStop(() => { + this.isScroll = true; + }) + .onScrollFrameBegin((offset: number) => { + this.isScroll = false; + return { offsetRemain: offset }; + }) + .layoutWeight(1) + .align(Alignment.Start) + } + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Top) + } + .layoutWeight(1) + .align(Alignment.Top) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + } + .tabBar($r('app.string.no_currency', this.chooseComparison.length)) + + TabContent() { + + } + .tabBar($r('app.string.currency_bar', 0)) + } + .barMode(BarMode.Fixed) + .barWidth($r('app.float.choose_tab_width')) + .layoutWeight(1) + } + } + + @Styles + listStyle() { + .height($r('app.float.list_style_height')) + .width($r('app.float.list_style_width')) + } +} + +@Extend(Text) +function buildScrollListText() { + .fontSize($r('app.float.list_text_size')) + .lineHeight($r('app.float.list_text_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + .width($r('app.float.list_text_width')) + .textAlign(TextAlign.Center) +} diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b06aa934f06c3e638ffbef21b21141002c4bc8f --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ComparisonDetailComponent } from './ComparisonDetailComponent'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import { CommonConstants } from '@ohos/basic'; + +@Component +export struct ComparisonDetailPage { + @State chooseComparison: ComparisonInfo[] = []; + + build() { + Row() { + ComparisonDetailComponent({ chooseComparison: this.chooseComparison, isPage: true }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1d8068f4823d21178f1e141f730682748c29ddb --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Comparison information entity class. + */ +export class ComparisonInfo { + name: ResourceStr; + code: ResourceStr; + type: ResourceStr; + establishedTime: ResourceStr; + scale: number; + risksLevel: ResourceStr; + rating: number; + dividends: number; + dividendsCount: number; + fundManager: ResourceStr; + + constructor(name: ResourceStr, code: ResourceStr, type: ResourceStr, establishedTime: ResourceStr, scale: number, + risksLevel: ResourceStr, rating: number, dividends: number, dividendsCount: number, fundManager: ResourceStr) { + this.name = name; + this.code = code; + this.type = type; + this.establishedTime = establishedTime; + this.scale = scale; + this.risksLevel = risksLevel; + this.rating = rating; + this.dividends = dividends; + this.dividendsCount = dividendsCount; + this.fundManager = fundManager; + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets b/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d5fc8dfe19281666769ceb2bdfe18790b8cec4e --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ComparisonInfo } from './ComparisonInfo'; + +/** + * Get fund comparison data. + */ +class FundComparisonViewModel { + getFundComparisonList(): ComparisonInfo[] { + let comparisonInfoList: ComparisonInfo[] = [ + new ComparisonInfo('XXXX基金1', '000000', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'H**'), + new ComparisonInfo('XXXX基金2', '111111', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'A**'), + new ComparisonInfo('XXXX基金3', '222222', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'B**'), + new ComparisonInfo('XXXX基金4', '333333', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'C**'), + new ComparisonInfo('XXXX基金5', '444444', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'D**'), + new ComparisonInfo('XXXX基金6', '555555', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'E**'), + new ComparisonInfo('XXXX基金7', '666666', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'F**'), + new ComparisonInfo('XXXX基金8', '777777', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'G**'), + new ComparisonInfo('XXXX基金9', '888888', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'H**'), + new ComparisonInfo('XXXX基金10', '999099', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'I**'), + new ComparisonInfo('XXXX基金11', '121212', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'J**'), + new ComparisonInfo('XXXX基金12', '131313', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'K**'), + new ComparisonInfo('XXXX基金13', '000001', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'L**'), + new ComparisonInfo('XXXX基金14', '000002', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'M**'), + new ComparisonInfo('XXXX基金15', '000003', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'N**'), + new ComparisonInfo('XXXX基金16', '000004', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'O**'), + new ComparisonInfo('XXXX基金17', '000005', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'P**'), + new ComparisonInfo('XXXX基金18', '000006', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Q**'), + new ComparisonInfo('XXXX基金19', '000007', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'R**'), + new ComparisonInfo('XXXX基金20', '000008', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'S**'), + new ComparisonInfo('XXXX基金21', '000009', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'T**'), + new ComparisonInfo('XXXX基金22', '323323', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'U**'), + new ComparisonInfo('XXXX基金23', '322443', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'V**'), + new ComparisonInfo('XXXX基金24', '667783', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'W**'), + new ComparisonInfo('XXXX基金25', '123456', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'X**'), + new ComparisonInfo('XXXX基金26', '643245', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Y**'), + new ComparisonInfo('XXXX基金27', '908998', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Z**'), + ]; + return comparisonInfoList; + } + + getComparisonCategory(): ResourceStr[] { + let category: ResourceStr[] = [ + $r('app.string.category_fund_code'), + $r('app.string.category_fund_type'), + $r('app.string.category_established_time'), + $r('app.string.category_new_scale'), + $r('app.string.category_risks_level'), + $r('app.string.category_three_rating'), + $r('app.string.category_accumulated_dividends'), + $r('app.string.category_dividends_count'), + $r('app.string.category_fund_manager') + ]; + + return category; + } +} + +export default new FundComparisonViewModel(); \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/module.json5 b/MultiFinancialManagement/features/fundComparison/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f242d81556965593d2576b5a9b91661a53b2cf11 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "fundComparison", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/color.json b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..5aab27af19f11e4e82a92cd24eaad2172d4ec455 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/color.json @@ -0,0 +1,68 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0dffffff" + }, + { + "name": "five_percent_white_fund", + "value": "#0d000000" + }, + { + "name": "sixty_percent_black", + "value": "#99ffffff" + }, + { + "name": "sixty_percent_white", + "value": "#99000000" + }, + { + "name": "forty_percent_white", + "value": "#66000000" + }, + { + "name": "start_button_background", + "value": "#0a59f7" + }, + { + "name": "start_comparison_background", + "value": "#660a59f7" + }, + { + "name": "name_color_1", + "value": "#0A59F7" + }, + { + "name": "name_color_2", + "value": "#E84026" + }, + { + "name": "name_color_3", + "value": "#28AD2B" + }, + { + "name": "background", + "value": "#F7F7F7" + }, + { + "name": "divider_background", + "value": "#1a000000" + }, + { + "name": "info_text", + "value": "#182431" + }, + { + "name": "ten_percent_white", + "value": "#1a000000" + }, + { + "name": "harmony_blue", + "value": "#0A59F7" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/float.json b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..a4195493f66887916b0e24a25febdd63b912ba40 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/float.json @@ -0,0 +1,296 @@ +{ + "float": [ + { + "name": "common_image", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "common_font_size", + "value": "16fp" + }, + { + "name": "common_divider", + "value": "1vp" + }, + { + "name": "title_text_size", + "value": "18fp" + }, + { + "name": "title_height", + "value": "56vp" + }, + { + "name": "search_margin_top", + "value": "24vp" + }, + { + "name": "name_size", + "value": "16fp" + }, + { + "name": "code_size", + "value": "14fp" + }, + { + "name": "common_border_width", + "value": "1vp" + }, + { + "name": "list_padding_bottom", + "value": "10vp" + }, + { + "name": "list_margin_left", + "value": "16vp" + }, + { + "name": "list_item_height_comparison", + "value": "64vp" + }, + { + "name": "tab_margin", + "value": "0vp" + }, + { + "name": "stack_text_size", + "value": "12vp" + }, + { + "name": "row_border_radius", + "value": "14vp" + }, + { + "name": "stack_row_padding_top", + "value": "5.5vp" + }, + { + "name": "stack_row_padding_bottom", + "value": "6.5vp" + }, + { + "name": "stack_row_padding_left", + "value": "8vp" + }, + { + "name": "stack_row_padding_right", + "value": "8vp" + }, + { + "name": "stack_row_margin_top", + "value": "8vp" + }, + { + "name": "close_image", + "value": "16vp" + }, + { + "name": "content_height", + "value": "45vp" + }, + { + "name": "choose_count_size", + "value": "16fp" + }, + { + "name": "choose_hints_size", + "value": "14fp" + }, + { + "name": "choose_hints_lint_height", + "value": "19vp" + }, + { + "name": "start_button_width_sm", + "value": "120vp" + }, + { + "name": "start_button_width", + "value": "221vp" + }, + { + "name": "start_button_height", + "value": "40vp" + }, + { + "name": "bottom_choose_height_show", + "value": "175vp" + }, + { + "name": "bottom_choose_height", + "value": "64vp" + }, + { + "name": "comparison_padding_left", + "value": "24vp" + }, + { + "name": "comparison_padding_right", + "value": "24vp" + }, + { + "name": "comparison_padding_bottom", + "value": "32vp" + }, + { + "name": "title_padding_top", + "value": "4vp" + }, + { + "name": "fund_name_size", + "value": "14fp" + }, + { + "name": "fund_name_line_height", + "value": "19vp" + }, + { + "name": "fund_name_width", + "value": "96vp" + }, + { + "name": "fund_name_height", + "value": "64vp" + }, + { + "name": "fixing_width", + "value": "8vp" + }, + { + "name": "fixing_height", + "value": "10.18vp" + }, + { + "name": "cancel_width", + "value": "6.79vp" + }, + { + "name": "cancel_height", + "value": "10.18vp" + }, + { + "name": "fixing_image_padding", + "value": "8vp" + }, + { + "name": "divider_fixing_width", + "value": "2vp" + }, + { + "name": "divider_fixing_height", + "value": "20vp" + }, + { + "name": "divider_fixing_radius", + "value": "1vp" + }, + { + "name": "list_fund_name_size", + "value": "14vp" + }, + { + "name": "list_name_line_height", + "value": "20vp" + }, + { + "name": "list_name_margin_left", + "value": "12vp" + }, + { + "name": "list_name_width", + "value": "96vp" + }, + { + "name": "list_name_height", + "value": "64vp" + }, + { + "name": "list_name_radius", + "value": "8vp" + }, + { + "name": "divider_margin_top", + "value": "11.5vp" + }, + { + "name": "divider_margin_bottom", + "value": "20.5vp" + }, + { + "name": "info_margin_left", + "value": "24vp" + }, + { + "name": "list_head_size", + "value": "14fp" + }, + { + "name": "list_head_line_height", + "value": "19vp" + }, + { + "name": "list_head_text_width", + "value": "60vp" + }, + { + "name": "list_head_width", + "value": "96vp" + }, + { + "name": "list_head_height", + "value": "56vp" + }, + { + "name": "list_head_border", + "value": "1vp" + }, + { + "name": "scroll_list_width", + "value": "104vp" + }, + { + "name": "list_style_height", + "value": "56vp" + }, + { + "name": "list_style_width", + "value": "100vp" + }, + { + "name": "list_text_size", + "value": "14fp" + }, + { + "name": "list_text_line_height", + "value": "19vp" + }, + { + "name": "list_text_width", + "value": "80vp" + }, + { + "name": "tab_text_size_fund", + "value": "16fp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "choose_tab_width", + "value": "300vp" + }, + { + "name": "image_margin_right", + "value": "24vp" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/string.json b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97b9ff420b50508c4a71f2e9b0ca2938160285a2 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "fund_popularity", + "value": "popularity" + }, + { + "name": "self_selected", + "value": "self-selected" + }, + { + "name": "select_fund", + "value": "Please select the fund from above" + }, + { + "name": "start_comparison", + "value": "Start the comparison" + }, + { + "name": "no_currency", + "value": "Non-monetary %d" + }, + { + "name": "currency_bar", + "value": "currency %d" + }, + { + "name": "count_choose", + "value": "%d funds selected" + }, + { + "name": "max_count_choose", + "value": "A maximum of 10 items can be selected for a single type" + }, + { + "name": "funding_comparison_title", + "value": "fund comparison" + }, + { + "name": "table_fund_name", + "value": "fund name" + }, + { + "name": "base_info", + "value": "base info" + }, + { + "name": "category_fund_code", + "value": "fund code" + }, + { + "name": "category_fund_type", + "value": "fund type" + }, + { + "name": "category_established_time", + "value": "established time" + }, + { + "name": "category_new_scale", + "value": "new scale" + }, + { + "name": "category_risks_level", + "value": "risks level" + }, + { + "name": "category_three_rating", + "value": "three year rating" + }, + { + "name": "category_accumulated_dividends", + "value": "accumulated dividends" + }, + { + "name": "category_dividends_count", + "value": "dividends count" + }, + { + "name": "category_fund_manager", + "value": "fund manager" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_fixing.png b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_fixing.png new file mode 100644 index 0000000000000000000000000000000000000000..47f0efbd64cf1806458077bc2e6c113e1589f34d Binary files /dev/null and b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_fixing.png differ diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_back.svg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..36565c84256be091beb9bd8d8494c5e073defc3f --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cancel + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_close.svg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..4e76b8417ed1a123708d76b64d3c16c8fc2f4908 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_close.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_close + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg new file mode 100644 index 0000000000000000000000000000000000000000..252b8fe5c6424f8d5f2eefaee0f4e410e771235e --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_enlarge + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg new file mode 100644 index 0000000000000000000000000000000000000000..142d090e8c48b30f9f694ae2571754ba110f1645 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reduce + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/icon.png b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/setting.jpeg b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiFinancialManagement/features/fundComparison/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/en_US/element/string.json b/MultiFinancialManagement/features/fundComparison/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97b9ff420b50508c4a71f2e9b0ca2938160285a2 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/en_US/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "fund_popularity", + "value": "popularity" + }, + { + "name": "self_selected", + "value": "self-selected" + }, + { + "name": "select_fund", + "value": "Please select the fund from above" + }, + { + "name": "start_comparison", + "value": "Start the comparison" + }, + { + "name": "no_currency", + "value": "Non-monetary %d" + }, + { + "name": "currency_bar", + "value": "currency %d" + }, + { + "name": "count_choose", + "value": "%d funds selected" + }, + { + "name": "max_count_choose", + "value": "A maximum of 10 items can be selected for a single type" + }, + { + "name": "funding_comparison_title", + "value": "fund comparison" + }, + { + "name": "table_fund_name", + "value": "fund name" + }, + { + "name": "base_info", + "value": "base info" + }, + { + "name": "category_fund_code", + "value": "fund code" + }, + { + "name": "category_fund_type", + "value": "fund type" + }, + { + "name": "category_established_time", + "value": "established time" + }, + { + "name": "category_new_scale", + "value": "new scale" + }, + { + "name": "category_risks_level", + "value": "risks level" + }, + { + "name": "category_three_rating", + "value": "three year rating" + }, + { + "name": "category_accumulated_dividends", + "value": "accumulated dividends" + }, + { + "name": "category_dividends_count", + "value": "dividends count" + }, + { + "name": "category_fund_manager", + "value": "fund manager" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/fundComparison/src/main/resources/zh_CN/element/string.json b/MultiFinancialManagement/features/fundComparison/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..979ecb5cecfe179cbc8ad28eecc5828957604998 --- /dev/null +++ b/MultiFinancialManagement/features/fundComparison/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "fund_popularity", + "value": "热门" + }, + { + "name": "self_selected", + "value": "自选" + }, + { + "name": "select_fund", + "value": "请从上方选择基金" + }, + { + "name": "start_comparison", + "value": "开始对比" + }, + { + "name": "no_currency", + "value": "非货币 %d" + }, + { + "name": "currency_bar", + "value": "货币 %d" + }, + { + "name": "count_choose", + "value": "已选择%d只基金" + }, + { + "name": "max_count_choose", + "value": "单类型最多选10只" + }, + { + "name": "funding_comparison_title", + "value": "基金比较" + }, + { + "name": "table_fund_name", + "value": "基金名称" + }, + { + "name": "base_info", + "value": "基本信息" + }, + { + "name": "category_fund_code", + "value": "基金代码" + }, + { + "name": "category_fund_type", + "value": "基金类型" + }, + { + "name": "category_established_time", + "value": "成立日期" + }, + { + "name": "category_new_scale", + "value": "最新规模 (亿元)" + }, + { + "name": "category_risks_level", + "value": "风险等级" + }, + { + "name": "category_three_rating", + "value": "三年评级" + }, + { + "name": "category_accumulated_dividends", + "value": "累计分红" + }, + { + "name": "category_dividends_count", + "value": "分红次数" + }, + { + "name": "category_fund_manager", + "value": "基金经理" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/Index.ets b/MultiFinancialManagement/features/home/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4afbb6428fbc6a1978c03c42d71fc9156b124e01 --- /dev/null +++ b/MultiFinancialManagement/features/home/Index.ets @@ -0,0 +1,3 @@ +export { AdvertisementDialog } from './src/main/ets/view/AdvertisementDialog'; +export { HomeComponent } from './src/main/ets/view/HomeComponent'; +export { AccountPage } from './src/main/ets/view/AccountPage'; \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/build-profile.json5 b/MultiFinancialManagement/features/home/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiFinancialManagement/features/home/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/hvigorfile.ts b/MultiFinancialManagement/features/home/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiFinancialManagement/features/home/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/features/home/obfuscation-rules.txt b/MultiFinancialManagement/features/home/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/features/home/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/oh-package.json5 b/MultiFinancialManagement/features/home/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..31c266be418d28dbc0529c9adc15f15eaa0d4a18 --- /dev/null +++ b/MultiFinancialManagement/features/home/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "home", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/MultiFinancialManagement/features/home/src/main/ets/constants/HomeConstants.ets b/MultiFinancialManagement/features/home/src/main/ets/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca4de3458b043e33cf754062f2f18a5104d954ee --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/constants/HomeConstants.ets @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Home constants for home feature. + */ +export class HomeConstants { + /** + * Title row space. + */ + static readonly TITLE_ROW_SPACE: number = 16; + + /** + * Gps row space. + */ + static readonly GPS_ROW_SPACE: number = 4; + + /** + * List space. + */ + static readonly LIST_SPACE: number = 12; + + /** + * Row space. + */ + static readonly ROW_SPACE: number = 12; + + /** + * Main business row space. + */ + static readonly MAIN_ROW_SPACE: number = 8; + + /** + * Button row space. + */ + static readonly BUTTON_ROW_SPACE: number = 4; + + /** + * List sliding offset. + */ + static readonly LIST_SLIDING_OFFSET: number = -250; + + /** + * List sliding offset under lg power outage. + */ + static readonly LIST_SLIDING_OFFSET_LG: number = -150; + + /** + * Get business data start index. + */ + static readonly BUSINESS_DATA_COUNT_START: number = 0; + + /** + * Get business data under sm power outage. + */ + static readonly BUSINESS_DATA_COUNT_SM: number = 4; + + /** + * Get business data under md power outage. + */ + static readonly BUSINESS_DATA_COUNT_MD: number = 6; + + /** + * Get business data under lg power outage. + */ + static readonly BUSINESS_DATA_COUNT_LG: number = 8; + + /** + * Get swiper display count under sm power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_SM: number = 1; + + /** + * Get swiper display count under md power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_MD: number = 2; + + /** + * Get swiper display count under lg power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_LG: number = 4; + + /** + * Get list lanes count under sm power outage. + */ + static readonly LIST_LANES_COUNT_SM: number = 1; + + /** + * Get list lanes count under md power outage. + */ + static readonly LIST_LANES_COUNT_MD: number = 2; + + /** + * Get list lanes count under lg power outage. + */ + static readonly LIST_LANES_COUNT_LG: number = 4; + + /** + * Get swiper item space under sm power outage. + */ + static readonly SWIPER_SPACE_SM: number = 13; + + /** + * Get swiper item space under md power outage. + */ + static readonly SWIPER_SPACE_MD: number = 13; + + /** + * Get swiper item space under lg power outage. + */ + static readonly SWIPER_SPACE_LG: number = 16; + + /** + * Get row space under md power outage. + */ + static readonly BUSINESS_ROW_SPACE_MD: number = 12; + + /** + * Get row space under lg power outage. + */ + static readonly BUSINESS_ROW_SPACE_LG: number = 30; + + /** + * Get flex height under sm power outage. + */ + static readonly DEMAND_FLEX_HEIGHT_SM: string = '96vp'; + + /** + * Get flex height. + */ + static readonly DEMAND_FLEX_HEIGHT: string = '48vp'; + + /** + * Get column width. + */ + static readonly DEMAND_LG_WIDTH: string = '32%'; + + /** + * Get main business row width. + */ + static readonly MAIN_BUSINESS_WIDTH: string = '20%'; +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/AccountComponent.ets b/MultiFinancialManagement/features/home/src/main/ets/view/AccountComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f42f68575cb779a7db86b10e74f24b87fe2f112 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/AccountComponent.ets @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '@ohos/basic/Index'; +import { DemandDepositComponent } from './DemandDepositComponent'; +import { InvestmentComponent } from './InvestmentComponent'; +import { LiabilitiesComponent } from './LiabilitiesComponent'; + +@Preview +@Component +export struct AccountComponent { + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + + build() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_SM + } + }) { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + Text($r('app.string.account_all_info')) + .fontSize($r('app.float.account_font_size')) + .fontColor(Color.White) + Image($r('app.media.ic_public_more')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + Row() { + Text($r('app.string.account_count')) + .fontSize($r('app.float.account_count_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.account_image_width')) + .height($r('app.float.common_image_height')) + .margin({ + left: $r('app.float.account_margin_left') + }) + .fillColor(Color.White) + } + .margin({ + top: this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_margin_top_lg') : $r('app.float.account_margin_top') + }) + Row() { + Text($r('app.string.yesterday_earnings')) + .fontSize($r('app.float.account_small_font_size')) + .fontColor(Color.White) + } + .backgroundColor($r('app.color.five_percent_white')) + .padding($r('app.float.account_padding')) + .borderRadius($r('app.float.earnings_radius')) + .margin({ + top: $r('app.float.account_margin'), + bottom: this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_margin_bottom_lg') : $r('app.float.account_margin') + }) + Row() { + this.buildAccountItemInfo($r('app.string.current_period_amount'), $r('app.string.current_period')) + this.buildAccountItemInfo($r('app.string.investment_amount'), $r('app.string.investment_name')) + this.buildAccountItemInfo($r('app.string.remaining_due_amount'), $r('app.string.remaining_due_month')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + .height(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.FULL_HEIGHT_PERCENT : $r('app.float.account_top_height')) + .padding({ + top: $r('app.float.account_top_padding'), + bottom: $r('app.float.account_padding_common'), + left: $r('app.float.account_padding_common'), + right: $r('app.float.account_padding_common') + }) + } + .linearGradient({ + direction: GradientDirection.Left, + colors: [[$r('app.color.top_start'), 0], [$r('app.color.top_end'), 1]] + }) + .padding({ + top: this.topHeight + }) + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_MD + } + }) { + Scroll() { + Column() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + Circle() + .fill($r('app.color.circle_color')) + .width($r('app.float.circle_width_height')) + .height($r('app.float.circle_width_height')) + .margin($r('app.float.account_margin')) + Text($r('app.string.prompt_message')) + .fontSize($r('app.float.message_font_size')) + .lineHeight($r('app.float.account_lint_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + } + + Row() { + Text($r('app.string.current_period')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.current_period_color')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.margin_common'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + DemandDepositComponent({ breakPoint: this.breakPoint }) + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Circle() + .fill($r('app.color.circle_color')) + .width($r('app.float.circle_width_height')) + .height($r('app.float.circle_width_height')) + .margin($r('app.float.account_margin')) + Text($r('app.string.prompt_message')) + .fontSize($r('app.float.message_font_size')) + .lineHeight($r('app.float.account_lint_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + } + Row() { + Text($r('app.string.investment_name')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.investment_name')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.account_margin'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + InvestmentComponent({ breakPoint: this.breakPoint }) + Row() { + Text($r('app.string.liabilities_name')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.liabilities_name')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.margin_common'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + LiabilitiesComponent({ breakPoint: this.breakPoint }) + } + .justifyContent(FlexAlign.Start) + } + .padding({ + left: this.breakPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.account_content_padding') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.account_content_padding') : 0 + }) + .scrollBar(BarState.Off) + } + .backgroundColor($r('app.color.account_background')) + .padding({ + bottom: this.bottom + }) + } + .backgroundColor($r('app.color.account_background')) + } + + @Builder + buildAccountItemInfo(amount: ResourceStr, name: ResourceStr) { + Column() { + Text(amount) + .fontSize($r('app.float.amount_font_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + Text(name) + .fontSize($r('app.float.account_small_font_size')) + .fontColor(Color.White) + .opacity(0.6) + .margin({ + top: $r('app.float.amount_margin') + }) + } + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/AccountPage.ets b/MultiFinancialManagement/features/home/src/main/ets/view/AccountPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c10a7cf39398e3e403b5ea07e53107367797295 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/AccountPage.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { window } from '@kit.ArkUI'; +import { CommonConstants } from '@ohos/basic/Index'; +import { AccountComponent } from './AccountComponent'; + +@Component +export struct AccountPage { + @StorageProp('avoidArea') topHeight: number = 0; + + onPageShow() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let area = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + let topHeight = px2vp(area.topRect.height); + if (topHeight > 0) { + windowStage.setWindowLayoutFullScreen(true); + } + }); + } + + onPageHide() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + if (this.topHeight > 0) { + windowStage.setWindowLayoutFullScreen(false); + } + }); + } + + build() { + Row() { + AccountComponent() + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/AdvertisementDialog.ets b/MultiFinancialManagement/features/home/src/main/ets/view/AdvertisementDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..408e4536d82c30e12bff5fc1e9df0f50b9f14e69 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/AdvertisementDialog.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, CommonConstants } from '@ohos/basic'; +// [Start advertisement_dialog] +@CustomDialog +export struct AdvertisementDialog { + @StorageProp('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + controller: CustomDialogController = new CustomDialogController({ + builder: AdvertisementDialog() + }); + + build() { + Column() { + // [StartExclude advertisement_dialog] + Row() { + Image($r('app.media.ic_public_close')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + } + .justifyContent(FlexAlign.End) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .alignItems(VerticalAlign.Center) + .height($r('app.float.common_height')) + .onClick(() => { + this.controller.close(); + }) + + Image($r('app.media.ic_dialog_phone')) + .width(new BreakpointUtil({ + sm: $r('app.float.dialog_width_sm'), + md: $r('app.float.dialog_width_md'), + lg: $r('app.float.dialog_width_lg') + }).getValue(this.currentPoint)) + .height(new BreakpointUtil({ + sm: $r('app.float.dialog_height_sm'), + md: $r('app.float.dialog_height_md'), + lg: $r('app.float.dialog_height_md') + }).getValue(this.currentPoint)) + .borderRadius($r('app.float.dialog_border_radius')) + .onClick(() => { + this.controller.close(); + }) + // [EndExclude advertisement_dialog] + } + .width(new BreakpointUtil({ + sm: $r('app.float.dialog_width_sm'), + md: $r('app.float.dialog_width_md'), + lg: $r('app.float.dialog_width_lg') + }).getValue(this.currentPoint)) + .height(new BreakpointUtil({ + sm: $r('app.float.dialog_all_height_sm'), + md: $r('app.float.dialog_all_height_md'), + lg: $r('app.float.dialog_all_height_lg') + }).getValue(this.currentPoint)) + } +} +// [End advertisement_dialog] \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/DemandDepositComponent.ets b/MultiFinancialManagement/features/home/src/main/ets/view/DemandDepositComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..150837770b0753c9b0be5b1badd3d7fa4afb465e --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/DemandDepositComponent.ets @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '@ohos/basic/Index'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct DemandDepositComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row({ space: HomeConstants.ROW_SPACE }) { + Column() { + Row() { + this.buildSavingCard() + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) + + Text($r('app.string.save_card_account')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildColumnItemStyles() + + Column() { + Row() { + Text($r('app.string.current_deposit')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) + Text($r('app.string.current_deposit_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildColumnItemStyles() + Column() { + Row() { + Text($r('app.string.day_day_treasure')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) + Column() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.yesterday_earnings_day')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .alignItems(HorizontalAlign.Start) + } + .buildColumnItemStyles() + } + .backgroundColor($r('app.color.account_background')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + bottom: $r('app.float.margin_common') + }) + .justifyContent(FlexAlign.SpaceBetween) + } else { + Row() { + Column() { + Row() { + this.buildSavingCard() + + Row() { + Text($r('app.string.save_card_account')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + Row() { + Text($r('app.string.current_deposit')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + Row() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + + if (this.breakPoint === CommonConstants.BREAK_POINT_MD) { + Divider() + .vertical(true) + .height($r('app.float.divider_height')) + .width($r('app.float.divider_width')) + .color($r('app.color.divider_color')) + .margin({ + left: $r('app.float.divider_margin'), + right: $r('app.float.divider_margin') + }) + } + Row() { + Text($r('app.string.day_day_treasure')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + Row() { + Column() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.yesterday_earnings_day')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + } + .flexBasis(this.breakPoint === CommonConstants.BREAK_POINT_SM ? + HomeConstants.DEMAND_FLEX_HEIGHT_SM : HomeConstants.DEMAND_FLEX_HEIGHT) + } + } + .margin({ + right: this.breakPoint === CommonConstants.BREAK_POINT_MD ? + $r('app.float.margin_common') : $r('app.float.account_padding_common'), + left: this.breakPoint === CommonConstants.BREAK_POINT_MD ? + $r('app.float.margin_common') : $r('app.float.account_padding_common') + }) + .padding({ + top: $r('app.float.account_item_padding_tb'), + bottom: $r('app.float.account_item_padding_tb'), + right: $r('app.float.account_item_padding_rl'), + left: $r('app.float.account_item_padding_rl') + }) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + .justifyContent(FlexAlign.SpaceBetween) + } + } + + @Builder + buildSavingCard() { + Row() { + Text($r('app.string.saving_card')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + this.buildImageUpwards(); + } + } + + @Builder + buildImageUpwards() { + Image($r('app.media.ic_public_upwards')) + .width($r('app.float.image_account')) + .height($r('app.float.image_account')) + .margin({ + right: $r('app.float.current_period_margin') + }) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildDemandRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) +} + +@Extend(Column) +function buildColumnItemStyles() { + .width(HomeConstants.DEMAND_LG_WIDTH) + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .height($r('app.float.column_item_height')) + .padding($r('app.float.account_padding_common')) + .borderRadius($r('app.float.common_radius')) +} diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/HomeComponent.ets b/MultiFinancialManagement/features/home/src/main/ets/view/HomeComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..61d21abd07b93c2e207d39268c5fca0cd263ed5f --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/HomeComponent.ets @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, BusinessInfo, CommonConstants, RouterConstants } from '@ohos/basic'; +import { HomeConstants } from '../constants/HomeConstants'; +import HomeViewModel from '../viewmodel/HomeViewModel'; + +@Component +export struct HomeComponent { + @Prop currentPoint: string = CommonConstants.BREAK_POINT_SM; + @Link scrollY: number; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + private offsetValue: number = 0; + + build() { + Row() { + Column() { + Row({ space: HomeConstants.TITLE_ROW_SPACE }) { + Row({ space: HomeConstants.GPS_ROW_SPACE }) { + Image($r('app.media.ic_public_gps')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + Text($r('app.string.gps_location')) + .fontSize($r('app.float.location_size')) + .fontColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + .lineHeight($r('app.float.location_text_height')) + .fontWeight(FontWeight.Normal) + } + .width('15%') + + Blank() + + Search({ placeholder: $r('app.string.search_placeholder') }) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.search_width_sm') : $r('app.float.search_width')) + .borderColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? + $r('app.color.five_percent_black') : $r('app.color.five_percent_white')) + .placeholderColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? + $r('app.color.sixty_percent_black_home') : $r('app.color.sixty_percent_white_home')) + .enableKeyboardOnFocus(false) + .searchIcon({ + color: this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? + $r('app.color.sixty_percent_black_home') : $r('app.color.sixty_percent_white_home') + }) + + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + + Image($r('app.media.ic_public_add_norm')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Scroll() { + Column() { + this.buildMainBusiness() + + Column() { + if (this.currentPoint === CommonConstants.BREAK_POINT_SM) { + this.buildButtonBusiness(HomeViewModel.getPhoneBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_SM)) + this.buildButtonBusiness(HomeViewModel.getPhoneBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_SM)) + } + if (this.currentPoint === CommonConstants.BREAK_POINT_MD) { + this.buildButtonBusiness(HomeViewModel.getFoldBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_MD)) + this.buildButtonBusiness(HomeViewModel.getFoldBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_MD)) + } + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.buildButtonBusiness(HomeViewModel.getTabletBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_LG)) + this.buildButtonBusiness(HomeViewModel.getTabletBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_LG)) + } + } + .backgroundColor(Color.White) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.business_border_radius')) + .padding(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.business_padding_lg') : $r('app.float.business_padding')) + .margin({ + top: $r('app.float.business_margin_top'), + bottom: this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.business_margin_bottom_lg') : $r('app.float.business_margin_bottom') + }) + .height(new BreakpointUtil({ + sm: $r('app.float.business_width_sm'), + md: $r('app.float.business_width_md'), + lg: $r('app.float.business_width_lg') + }).getValue(this.currentPoint)) + + Swiper() { + ForEach(HomeViewModel.getSwiperBusiness(), (item: BusinessInfo) => { + Image(item.icon) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .borderRadius($r('app.float.swiper_image_border_radius')) + .height(new BreakpointUtil({ + sm: $r('app.float.swiper_image_height_sm'), + md: $r('app.float.swiper_image_height_md'), + lg: $r('app.float.swiper_image_height_lg') + }).getValue(this.currentPoint)) + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .autoPlay(true) + .loop(true) + .itemSpace(new BreakpointUtil({ + sm: HomeConstants.SWIPER_SPACE_SM, + md: HomeConstants.SWIPER_SPACE_MD, + lg: HomeConstants.SWIPER_SPACE_LG + }).getValue(this.currentPoint)) + .displayCount(new BreakpointUtil({ + sm: HomeConstants.SWIPER_DISPLAY_COUNT_SM, + md: HomeConstants.SWIPER_DISPLAY_COUNT_MD, + lg: HomeConstants.SWIPER_DISPLAY_COUNT_LG + }).getValue(this.currentPoint)) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_SM ? true : false) + + Row() { + Text($r('app.string.home_fortune_picks')) + .fontColor($r('app.color.pick_text')) + .fontSize($r('app.float.pick_size')) + .lineHeight($r('app.float.pick_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + } + .justifyContent(FlexAlign.Start) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.pick_margin_top'), + bottom: $r('app.float.pick_margin_bottom') + }) + + List({ space: HomeConstants.LIST_SPACE }) { + ForEach(HomeViewModel.getListBusiness(), (item: BusinessInfo) => { + ListItem() { + Image(item.icon) + .height(new BreakpointUtil({ + sm: $r('app.float.list_image_height_sm'), + md: $r('app.float.list_image_height_md'), + lg: $r('app.float.list_image_height_lg') + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .borderRadius($r('app.float.list_image_radius')) + .onClick(() => { + this.pageIndexInfos.pushPathByName(RouterConstants.FUNDING_URL, null); + }) + } + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .lanes(new BreakpointUtil({ + sm: HomeConstants.LIST_LANES_COUNT_SM, + md: HomeConstants.LIST_LANES_COUNT_MD, + lg: HomeConstants.LIST_LANES_COUNT_LG + }).getValue(this.currentPoint), $r('app.float.list_lanes_space')) + } + } + .padding({ + top: $r('app.float.scroll_margin_top'), + bottom: $r('app.float.common_height') + }) + .scrollBar(BarState.Off) + .onWillScroll((xOffset: number, yOffset: number) => { + this.offsetValue = this.offsetValue - yOffset; + if (this.offsetValue > 0) { + this.offsetValue = 0; + } + this.scrollY = vp2px(this.offsetValue); + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .alignItems(VerticalAlign.Top) + .padding({ + top: $r('app.float.content_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + + @Builder + buildMainBusiness() { + Row() { + ForEach(HomeViewModel.getMainBusiness(), (item: BusinessInfo) => { + if (this.currentPoint === CommonConstants.BREAK_POINT_SM) { + Column({ space: HomeConstants.MAIN_ROW_SPACE }) { + Image(item.icon) + .width($r('app.float.main_image')) + .height($r('app.float.main_image')) + Text(item.text) + .fontSize($r('app.float.main_business_size')) + .fontColor(Color.White) + } + .onClick(() => { + if (item.router) { + this.pageIndexInfos.pushPathByName(item.router, null); + } + }) + } else { + Row() { + Image(item.iconBig) + .width($r('app.float.main_image_big')) + .height($r('app.float.main_image_big')) + Text(item.text) + .fontSize($r('app.float.main_business_size')) + .fontColor(Color.White) + .margin({ + left: new BreakpointUtil({ + md: HomeConstants.BUSINESS_ROW_SPACE_MD, + lg: HomeConstants.BUSINESS_ROW_SPACE_LG + }).getValue(this.currentPoint) + }) + } + .width(HomeConstants.MAIN_BUSINESS_WIDTH) + .height(new BreakpointUtil({ + md: $r('app.float.business_row_height_md'), + lg: $r('app.float.business_row_height_lg') + }).getValue(this.currentPoint)) + .alignSelf(ItemAlign.Center) + .justifyContent(FlexAlign.Center) + .borderRadius($r('app.float.business_row_radius')) + .backgroundColor($r('app.color.business_background')) + .onClick(() => { + if (item.router) { + this.pageIndexInfos.pushPathByName(item.router, null); + } + }) + } + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: new BreakpointUtil({ + sm: $r('app.float.main_padding_left_sm'), + md: $r('app.float.main_padding_left_md'), + lg: $r('app.float.main_padding_left_lg') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.main_padding_left_sm'), + md: $r('app.float.main_padding_left_md'), + lg: $r('app.float.main_padding_left_lg') + }).getValue(this.currentPoint) + }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + + @Builder + buildButtonBusiness(list: BusinessInfo[]) { + Row() { + ForEach(list, (item: BusinessInfo) => { + Column({ space: HomeConstants.BUTTON_ROW_SPACE }) { + Image(item.icon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontColor(Color.Black) + } + .width($r('app.float.button_business_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/InvestmentComponent.ets b/MultiFinancialManagement/features/home/src/main/ets/view/InvestmentComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..767a0e73c5209c260ff2fe6f28b17cfe2e464c5b --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/InvestmentComponent.ets @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, CommonConstants } from '@ohos/basic/Index'; + +@Component +export struct InvestmentComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + Column() { + Row() { + Row() { + Text($r('app.string.investment_wealth')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageUpwards() + } + Row() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Text($r('app.string.investment_wealth_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + bottom: '40vp' + }) + } + Row() { + Text($r('app.string.half_year_treasure')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + this.buildImageArrowRight() + } + .buildDemandRowStyles() + + Row() { + Text() { + Span($r('app.string.earnings_holding_positions')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.earnings_holding_positions_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.earnings_holding_positions')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildHalfRowHeight() + + Row() { + Text() { + Span($r('app.string.last_redemption_date')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.last_date')) + .buildSpanFont() + .opacity(0.6) + } + Text($r('app.string.position_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .buildHalfRowHeight() + } + .margin({ + right: $r('app.float.account_margin'), + left: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_margin') : 0 + }) + .padding({ + top: $r('app.float.account_item_padding_tb'), + bottom: $r('app.float.account_item_padding_tb'), + right: $r('app.float.account_item_padding_rl'), + left: $r('app.float.account_item_padding_rl') + }) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + Column() { + Row() { + Row() { + Text($r('app.string.fund_name')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageUpwards() + } + Row() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Text($r('app.string.investment_wealth_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + bottom: '40vp' + }) + } + Row() { + Text($r('app.string.exponent_c')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + this.buildImageArrowRight() + } + .buildDemandRowStyles() + Row() { + Text() { + Span($r('app.string.yesterday_earnings_exponent')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.yesterday_exponent_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.yesterday_earnings_exponent')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildHalfRowHeight() + Row() { + Text() { + Span($r('app.string.earnings_holding_positions')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.investment_holding_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.earnings_holding_positions')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + Text($r('app.string.position_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .buildHalfRowHeight() + } + .margin({ + top: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.investment_margin_top') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_padding_common') : 0, + left: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_padding_common') : 0 + }) + .padding({ + top: $r('app.float.account_item_padding_tb'), + bottom: $r('app.float.account_item_padding_tb'), + right: $r('app.float.account_item_padding_rl'), + left: $r('app.float.account_item_padding_rl') + }) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + } + .height(new BreakpointUtil({ + sm: $r('app.float.investment_flex_height_sm'), + md: $r('app.float.investment_flex_height'), + lg: $r('app.float.investment_flex_height_lg'), + }).getValue(this.breakPoint)) + .margin({ + left: this.breakPoint === CommonConstants.BREAK_POINT_MD ? $r('app.float.margin_common') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_MD ? $r('app.float.margin_common') : 0 + }) + } + + @Builder + buildImageUpwards() { + Image($r('app.media.ic_public_upwards')) + .width($r('app.float.image_account')) + .height($r('app.float.image_account')) + .margin({ + right: $r('app.float.current_period_margin') + }) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildHalfRowHeight() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.investment_row_height')) +} + +@Extend(Span) +function buildSpanFont() { + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) +} + +@Extend(Text) +function buildFontSixteen() { + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) +} + +@Extend(Row) +function buildDemandRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/ets/view/LiabilitiesComponent.ets b/MultiFinancialManagement/features/home/src/main/ets/view/LiabilitiesComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..f274054fbda3684cd032d492187480cc706f8a47 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/view/LiabilitiesComponent.ets @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointUtil, CommonConstants } from '@ohos/basic/Index'; + +@Component +export struct LiabilitiesComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + Column() { + Row() { + Text($r('app.string.credit_card_account')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Image($r('app.media.ic_public_more_list')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + } + .buildRowStyles() + + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + if (this.breakPoint !== CommonConstants.BREAK_POINT_SM) { + Column() { + Row() { + Text($r('app.string.remaining_available_count')) + .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_big_font') : $r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + Row() { + Text($r('app.string.remaining_available_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + } + Divider() + .vertical(true) + .height($r('app.float.liabilities_divider_height')) + .width($r('app.float.divider_width')) + .color($r('app.color.divider_color')) + .margin({ + left: $r('app.float.divider_margin'), + right: $r('app.float.divider_margin') + }) + Column() { + Row() { + Text($r('app.string.remaining_due_count')) + .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_big_font') : $r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + Row() { + Text($r('app.string.remaining_due')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + } + } else { + Row() { + Text() { + Span($r('app.string.remaining_available_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + Span($r('app.string.remaining_available_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.small_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + .buildRowStyles() + + Row() { + Text() { + Span($r('app.string.remaining_due')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + Span($r('app.string.remaining_due_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + .buildRowStyles() + } + } + .height($r('app.float.liabilities_item_height')) + } + .height($r('app.float.liabilities_height')) + .margin({ + right: new BreakpointUtil({ + sm: $r('app.float.account_margin'), + md: $r('app.float.margin_common'), + lg: 0 + }).getValue(this.breakPoint), + left: new BreakpointUtil({ + sm: $r('app.float.account_margin'), + md: $r('app.float.margin_common'), + lg: 0 + }).getValue(this.breakPoint) + }) + .padding({ + top: $r('app.float.account_item_padding_tb'), + bottom: $r('app.float.account_item_padding_tb'), + right: $r('app.float.account_item_padding_rl'), + left: $r('app.float.account_item_padding_rl') + }) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) +} diff --git a/MultiFinancialManagement/features/home/src/main/ets/viewmodel/HomeViewModel.ets b/MultiFinancialManagement/features/home/src/main/ets/viewmodel/HomeViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7b049780241b8500193df678d4270e2268068bf --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/ets/viewmodel/HomeViewModel.ets @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BusinessInfo, RouterConstants } from '@ohos/basic'; + +/** + * Get home data. + */ +class HomeViewModel { + getMainBusiness(): BusinessInfo[] { + let mainBusinessList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_account'), $r('app.string.home_account'), $r('app.media.ic_public_account'), RouterConstants.ACCOUNT_PAGE_URL), + new BusinessInfo($r('app.media.ic_details'), $r('app.string.home_details'), $r('app.media.ic_public_details')), + new BusinessInfo($r('app.media.ic_transfers'), $r('app.string.home_transfers'), $r('app.media.ic_public_transfers')), + new BusinessInfo($r('app.media.ic_loans'), $r('app.string.home_loans'), $r('app.media.ic_public_loans')) + ]; + return mainBusinessList; + } + + getAllBusiness(): BusinessInfo[] { + let allBusinessList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_fund_investment'), $r('app.string.home_fund_investment')), + new BusinessInfo($r('app.media.ic_wealth_products'), $r('app.string.home_wealth_products')), + new BusinessInfo($r('app.media.ic_home_cards'), $r('app.string.home_cards')), + new BusinessInfo($r('app.media.ic_home_notes'), $r('app.string.home_notes')), + new BusinessInfo($r('app.media.ic_quick_profit'), $r('app.string.home_quick_profit')), + new BusinessInfo($r('app.media.ic_precious_metals'), $r('app.string.home_precious_metals')), + new BusinessInfo($r('app.media.ic_deposits'), $r('app.string.home_deposits')), + new BusinessInfo($r('app.media.ic_payment'), $r('app.string.home_payment')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')) + ]; + return allBusinessList; + } + + getPhoneBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 7); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getFoldBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 11); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getTabletBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 15); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getSwiperBusiness(): BusinessInfo[] { + let swiperBusinessInfoList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_swiper_hand'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_fingerprints'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_book'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_eyeglasses'), $r('app.string.swiper_image')) + ]; + return swiperBusinessInfoList; + } + + getListBusiness(): BusinessInfo[] { + let listBusinessInfoList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_list_paper'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_contracts'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_hello'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_money'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')) + ]; + return listBusinessInfoList; + } +} + +export default new HomeViewModel(); \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/module.json5 b/MultiFinancialManagement/features/home/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0d2d567275cbb9fb91c8a070cb5f5de143475e41 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "home", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/element/color.json b/MultiFinancialManagement/features/home/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..ecb94f3781b51e5866e41a3e7d8706dd61d6583b --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/element/color.json @@ -0,0 +1,76 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_white", + "value": "#0DFFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0D000000" + }, + { + "name": "sixty_percent_white_home", + "value": "#99FFFFFF" + }, + { + "name": "sixty_percent_black_home", + "value": "#99000000" + }, + { + "name": "pick_text", + "value": "#182431" + }, + { + "name": "business_background", + "value": "#33FFFFFF" + }, + { + "name": "top_start", + "value": "#1C60EA" + }, + { + "name": "top_end", + "value": "#83ABFB" + }, + { + "name": "circle_color", + "value": "#FFF980" + }, + { + "name": "current_period_color", + "value": "#1F69FF" + }, + { + "name": "investment_name", + "value": "#C8974F" + }, + { + "name": "liabilities_name", + "value": "#C8974F" + }, + { + "name": "account_background", + "value": "#F7F7F7" + }, + { + "name": "image_arrow", + "value": "#4d000000" + }, + { + "name": "divider_color", + "value": "#1a000000" + }, + { + "name": "earnings_holding_positions", + "value": "#E84026" + }, + { + "name": "yesterday_earnings_exponent", + "value": "#28AD2B" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/element/float.json b/MultiFinancialManagement/features/home/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..031478a30136e9aab9aa43ce69028c6a7fce285b --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/element/float.json @@ -0,0 +1,412 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "margin_common", + "value": "24vp" + }, + { + "name": "dialog_width_sm", + "value": "280vp" + }, + { + "name": "dialog_width_md", + "value": "302vp" + }, + { + "name": "dialog_width_lg", + "value": "394vp" + }, + { + "name": "dialog_margin_bottom", + "value": "12vp" + }, + { + "name": "dialog_height_sm", + "value": "328vp" + }, + { + "name": "dialog_height_md", + "value": "394vp" + }, + { + "name": "dialog_border_radius", + "value": "16vp" + }, + { + "name": "dialog_all_height_sm", + "value": "364vp" + }, + { + "name": "dialog_all_height_md", + "value": "430vp" + }, + { + "name": "dialog_all_height_lg", + "value": "430vp" + }, + { + "name": "location_size", + "value": "18fp" + }, + { + "name": "location_text_height", + "value": "25vp" + }, + { + "name": "gps_width", + "value": "64vp" + }, + { + "name": "business_border_radius", + "value": "16vp" + }, + { + "name": "business_padding_lg", + "value": "24vp" + }, + { + "name": "business_padding", + "value": "16vp" + }, + { + "name": "business_margin_top", + "value": "36vp" + }, + { + "name": "business_margin_bottom_lg", + "value": "16vp" + }, + { + "name": "business_margin_bottom", + "value": "12vp" + }, + { + "name": "business_width_sm", + "value": "136vp" + }, + { + "name": "business_width_md", + "value": "144vp" + }, + { + "name": "business_width_lg", + "value": "160vp" + }, + { + "name": "swiper_image_border_radius", + "value": "16vp" + }, + { + "name": "pick_size", + "value": "16fp" + }, + { + "name": "pick_text_height", + "value": "22vp" + }, + { + "name": "pick_margin_top", + "value": "21vp" + }, + { + "name": "pick_margin_bottom", + "value": "13vp" + }, + { + "name": "list_image_height", + "value": "160vp" + }, + { + "name": "list_image_radius", + "value": "16vp" + }, + { + "name": "list_lanes_space", + "value": "12vp" + }, + { + "name": "scroll_margin_top", + "value": "16vp" + }, + { + "name": "content_padding_top", + "value": "8vp" + }, + { + "name": "main_image", + "value": "48vp" + }, + { + "name": "main_business_size", + "value": "16fp" + }, + { + "name": "main_padding_left_sm", + "value": "0vp" + }, + { + "name": "main_padding_left_md", + "value": "21vp" + }, + { + "name": "main_padding_left_lg", + "value": "29vp" + }, + { + "name": "button_text_size", + "value": "12fp" + }, + { + "name": "button_business_width", + "value": "48vp" + }, + { + "name": "common_height", + "value": "56vp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "search_width_sm", + "value": "152vp" + }, + { + "name": "swiper_image_height_sm", + "value": "141vp" + }, + { + "name": "swiper_image_height_md", + "value": "132vp" + }, + { + "name": "swiper_image_height_lg", + "value": "115vp" + }, + { + "name": "list_image_height_sm", + "value": "185vp" + }, + { + "name": "list_image_height_md", + "value": "174vp" + }, + { + "name": "list_image_height_lg", + "value": "152vp" + }, + { + "name": "business_row_radius", + "value": "12vp" + }, + { + "name": "business_row_width_md", + "value": "116vp" + }, + { + "name": "business_row_width_lg", + "value": "222vp" + }, + { + "name": "business_row_height_md", + "value": "56vp" + }, + { + "name": "business_row_height_lg", + "value": "80vp" + }, + { + "name": "account_font_size", + "value": "16fp" + }, + { + "name": "account_count_size", + "value": "24vp" + }, + { + "name": "account_image_width", + "value": "12vp" + }, + { + "name": "account_margin_left", + "value": "12vp" + }, + { + "name": "account_margin_top_lg", + "value": "88vp" + }, + { + "name": "account_margin_top", + "value": "33vp" + }, + { + "name": "account_small_font_size", + "value": "12fp" + }, + { + "name": "account_padding", + "value": "8vp" + }, + { + "name": "earnings_radius", + "value": "14vp" + }, + { + "name": "account_margin", + "value": "16vp" + }, + { + "name": "account_margin_bottom_lg", + "value": "93vp" + }, + { + "name": "amount_font_size", + "value": "14fp" + }, + { + "name": "amount_margin", + "value": "8vp" + }, + { + "name": "account_top_height", + "value": "219vp" + }, + { + "name": "account_top_padding", + "value": "14vp" + }, + { + "name": "account_padding_common", + "value": "16vp" + }, + { + "name": "circle_width_height", + "value": "8vp" + }, + { + "name": "message_font_size", + "value": "14fp" + }, + { + "name": "account_lint_height", + "value": "22vp" + }, + { + "name": "current_period_margin", + "value": "12vp" + }, + { + "name": "current_period_padding", + "value": "16vp" + }, + { + "name": "common_radius", + "value": "16vp" + }, + { + "name": "account_content_padding", + "value": "32vp" + }, + { + "name": "image_account", + "value": "16vp" + }, + { + "name": "image_arrow", + "value": "12vp" + }, + { + "name": "image_arrow_margin", + "value": "8vp" + }, + { + "name": "column_item_height", + "value": "129vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "account_common_height", + "value": "48vp" + }, + { + "name": "account_big_font", + "value": "24fp" + }, + { + "name": "small_line_height", + "value": "19vp" + }, + { + "name": "divider_height", + "value": "36vp" + }, + { + "name": "divider_width", + "value": "1vp" + }, + { + "name": "divider_margin", + "value": "18vp" + }, + { + "name": "account_item_padding_tb", + "value": "4vp" + }, + { + "name": "account_item_padding_rl", + "value": "12vp" + }, + { + "name": "investment_row_height", + "value": "22vp" + }, + { + "name": "investment_margin_top", + "value": "12vp" + }, + { + "name": "liabilities_divider_height", + "value": "115vp" + }, + { + "name": "investment_flex_height_sm", + "value": "304vp" + }, + { + "name": "investment_flex_height", + "value": "148vp" + }, + { + "name": "investment_flex_height_lg", + "value": "220vp" + }, + { + "name": "liabilities_item_height", + "value": "115vp" + }, + { + "name": "liabilities_height", + "value": "300vp" + }, + { + "name": "main_image_big", + "value": "40" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/element/string.json b/MultiFinancialManagement/features/home/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b73d578c75a5b89d4cd52b7d974c94102a21e946 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/element/string.json @@ -0,0 +1,228 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "shenzhen" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "home_account", + "value": "account" + }, + { + "name": "home_details", + "value": "details" + }, + { + "name": "home_transfers", + "value": "transfers" + }, + { + "name": "home_loans", + "value": "loans" + }, + { + "name": "home_fund_investment", + "value": "fundInvestment" + }, + { + "name": "home_wealth_products", + "value": "wealthProducts" + }, + { + "name": "home_cards", + "value": "cards" + }, + { + "name": "home_notes", + "value": "notes" + }, + { + "name": "home_quick_profit", + "value": "quickProfit" + }, + { + "name": "home_precious_metals", + "value": "preciousMetals" + }, + { + "name": "home_deposits", + "value": "deposits" + }, + { + "name": "home_payment", + "value": "payment" + }, + { + "name": "home_quick_loan", + "value": "quickLoan" + }, + { + "name": "home_more", + "value": "more" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "fortunePicks" + }, + { + "name": "account_all_info", + "value": "Account Overview" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "Yesterday's earnings + 333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "current period+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "investment" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "remaining due this month" + }, + { + "name": "prompt_message", + "value": "Prepare for the old as soon as possible, worry-free old age, new users enjoy 3 gifts > >" + }, + { + "name": "liabilities_name", + "value": "liabilities" + }, + { + "name": "saving_card", + "value": "saving card" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "current deposit" + }, + { + "name": "current_deposit_count", + "value": "33333.3" + }, + { + "name": "day_day_treasure", + "value": "day and day treasure" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "Yesterday's earnings 1.33" + }, + { + "name": "investment_wealth", + "value": "financial management" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "half a year treasure" + }, + { + "name": "earnings_holding_positions", + "value": "earnings from holding positions" + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "last redemption date:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "position amount" + }, + { + "name": "fund_name", + "value": "fund" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX exponent C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "yesterday·s earnings" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "credit card personal consumption account" + }, + { + "name": "remaining_available_amount", + "value": "remaining available amount" + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "remaining RMB due" + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_account.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_account.png new file mode 100644 index 0000000000000000000000000000000000000000..9274cc5cb07c6564a13391f04c8087bb484b5dc7 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_account.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_deposits.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_deposits.png new file mode 100644 index 0000000000000000000000000000000000000000..22b2495c59082a514ae4c8be8802bad0267925fb Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_deposits.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_details.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_details.png new file mode 100644 index 0000000000000000000000000000000000000000..8f9ad39870ba85e252f9d287cf8b619d176eff80 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_details.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_dialog_phone.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_dialog_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..9d681984df2706f2e5553e2b2888bcc5eaed2672 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_dialog_phone.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_fund_investment.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_fund_investment.png new file mode 100644 index 0000000000000000000000000000000000000000..052a6e2c1f2ce12901d2b327dc1334ba90ed66c2 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_fund_investment.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_cards.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_cards.png new file mode 100644 index 0000000000000000000000000000000000000000..b3307a40f84bf7e5323c68cc1288b57f66c72997 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_cards.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fold_background.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fold_background.png new file mode 100644 index 0000000000000000000000000000000000000000..2ecbe63c76052be4f6f9cbb2dafd0e62238eff6d Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fold_background.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fortunes.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fortunes.png new file mode 100644 index 0000000000000000000000000000000000000000..e7fe3f2436e172ea1c31a25c6670f58be9c132c0 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_fortunes.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_mine.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_mine.png new file mode 100644 index 0000000000000000000000000000000000000000..69e2bdd33b492ab7bc1b1d826885ae41d37a8ecf Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_mine.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_more.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_more.png new file mode 100644 index 0000000000000000000000000000000000000000..b8a3dab6d37e77a6c9df1dc7da62c5b817564a53 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_more.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_notes.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_notes.png new file mode 100644 index 0000000000000000000000000000000000000000..25184579608e49f12fa944c84db7f52d31848fe8 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_notes.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_phone_background.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_phone_background.png new file mode 100644 index 0000000000000000000000000000000000000000..dba3b16cfcc0687ad7d0270fe96b339fb69abf83 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_phone_background.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_tablet_background.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_tablet_background.png new file mode 100644 index 0000000000000000000000000000000000000000..631fd5f624d63d7e4b96e81cc32b8167f182911d Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_home_tablet_background.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_life_filled.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..d94b66f2c34bcd05663a92b87eafc14d112df022 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_business.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_business.png new file mode 100644 index 0000000000000000000000000000000000000000..b1dda6987abb61b24b3d5eb6cdb05a429785d123 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_business.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_contracts.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_contracts.png new file mode 100644 index 0000000000000000000000000000000000000000..c2252d46a7b91c5c6e5d3ef911265b7e569ae09e Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_contracts.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_hello.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_hello.png new file mode 100644 index 0000000000000000000000000000000000000000..6ad303670f95b9e5e087b722262a9a38251855de Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_hello.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_money.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_money.png new file mode 100644 index 0000000000000000000000000000000000000000..a84291e3d70d679b6ab429be1965e44fec0cd9c3 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_money.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_paper.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_paper.png new file mode 100644 index 0000000000000000000000000000000000000000..17795c2916f5ca877c0ec954ad50d13d90ad2e8a Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_list_paper.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_loans.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_loans.png new file mode 100644 index 0000000000000000000000000000000000000000..9482750a67a6577dc135a8a4f6122d1d9537174b Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_loans.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_payment.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_payment.png new file mode 100644 index 0000000000000000000000000000000000000000..16d83f0e3685b71cfc1758949b8f0a36bd4f6aba Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_payment.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_precious_metals.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_precious_metals.png new file mode 100644 index 0000000000000000000000000000000000000000..a623cd7c9b90c5ead379db794255e9c639636fb4 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_precious_metals.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_account.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_account.png new file mode 100644 index 0000000000000000000000000000000000000000..346335f3cbfcf018e14c5369b2096ffb26cf75f7 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_account.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_add_norm.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_add_norm.svg new file mode 100644 index 0000000000000000000000000000000000000000..729f2774d24c6569215b1a0f1420ea09ecf976f4 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_add_norm.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_add_norm + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..18e4cfd5d4c9e319018d7e8686f814a9cedb684f --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_back.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_cards_filled.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..3a6ae14083e31e6a44e0e3793215a6bae4831441 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cards_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_close.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..4e76b8417ed1a123708d76b64d3c16c8fc2f4908 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_close.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_close + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_comments.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_details.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_details.png new file mode 100644 index 0000000000000000000000000000000000000000..057c1e22ddbdd44f21463417f5d33983c63082cb Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_details.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_gps.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_gps.svg new file mode 100644 index 0000000000000000000000000000000000000000..6120484838ca7d322a5d347fdf5a1e6aee1d3d64 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_gps.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_gps + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_home_filled.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..552138ac5580357040697ba05c977bbd60bf62bc --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_home_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_loans.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_loans.png new file mode 100644 index 0000000000000000000000000000000000000000..e332235efb1098f7f171130d5ccd320b5fb76ec0 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_loans.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..4c34b6411bd35efcb06b4d8cd269fc351bb3350e --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_more + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more_list.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..0a26842c9e251d43ca0e404c240f612b5268f799 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_more_list.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_more_list + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_transfers.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_transfers.png new file mode 100644 index 0000000000000000000000000000000000000000..aae95f868c3502e3a8273c10a75e5bb97451fea1 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_transfers.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_upwards.svg b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_upwards.svg new file mode 100644 index 0000000000000000000000000000000000000000..0474c94964c4f3ecf14b91e10adc938fbb3c5956 --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_public_upwards.svg @@ -0,0 +1,20 @@ + + + 矩形备份 2 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_loan.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_loan.png new file mode 100644 index 0000000000000000000000000000000000000000..0754573154a3032100675a008ca7420b201cec5b Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_loan.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_profit.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_profit.png new file mode 100644 index 0000000000000000000000000000000000000000..0e77bb25dda910b3acf7f8b7d80c280e88a3c5e1 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_quick_profit.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_book.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_book.png new file mode 100644 index 0000000000000000000000000000000000000000..4dfe9c862758f8fbbeb93707e5c322ee32666aae Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_book.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png new file mode 100644 index 0000000000000000000000000000000000000000..5f77fcceb1f62fad64645c4a4f13065f2c3f5a06 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png new file mode 100644 index 0000000000000000000000000000000000000000..96b768b0ae36f6c56518c5cd159e13b8ed1dd8be Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_hand.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_hand.png new file mode 100644 index 0000000000000000000000000000000000000000..3dd78e343c90bc161225c1faf237af8640c6bd44 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_swiper_hand.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_transfers.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_transfers.png new file mode 100644 index 0000000000000000000000000000000000000000..093200d0be1987f959c8350e9ed7cc175058774f Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_transfers.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_wealth_products.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_wealth_products.png new file mode 100644 index 0000000000000000000000000000000000000000..cc01479c27543073a8b3ed0c8ef1a91348bde102 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/ic_wealth_products.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/base/media/icon.png b/MultiFinancialManagement/features/home/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/en_US/element/string.json b/MultiFinancialManagement/features/home/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..474436a541dd2a48c369b35d4402c2985e6c5fee --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/en_US/element/string.json @@ -0,0 +1,224 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "shenzhen" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "home_account", + "value": "account" + }, + { + "name": "home_details", + "value": "details" + }, + { + "name": "home_transfers", + "value": "transfers" + }, + { + "name": "home_loans", + "value": "loans" + }, + { + "name": "home_fund_investment", + "value": "fundInvestment" + }, + { + "name": "home_wealth_products", + "value": "wealthProducts" + }, + { + "name": "home_cards", + "value": "cards" + }, + { + "name": "home_notes", + "value": "notes" + }, + { + "name": "home_quick_profit", + "value": "quickProfit" + }, + { + "name": "home_precious_metals", + "value": "preciousMetals" + }, + { + "name": "home_deposits", + "value": "deposits" + }, + { + "name": "home_payment", + "value": "payment" + }, + { + "name": "home_quick_loan", + "value": "quickLoan" + }, + { + "name": "home_more", + "value": "more" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "fortunePicks" + }, + { + "name": "account_all_info", + "value": "Account Overview" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "Yesterday's earnings + 333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "current period+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "investment" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "remaining due this month" + }, + { + "name": "prompt_message", + "value": "Prepare for the old as soon as possible, worry-free old age, new users enjoy 3 gifts > >" + }, + { + "name": "liabilities_name", + "value": "liabilities" + }, + { + "name": "saving_card", + "value": "saving card" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "current deposit" + }, + { + "name": "day_day_treasure", + "value": "day and day treasure" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "Yesterday's earnings 1.33" + }, + { + "name": "investment_wealth", + "value": "financial management" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "half a year treasure" + }, + { + "name": "earnings_holding_positions", + "value": "earnings from holding positions" + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "last redemption date:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "position amount" + }, + { + "name": "fund_name", + "value": "fund" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX exponent C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "yesterday·s earnings" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "credit card personal consumption account" + }, + { + "name": "remaining_available_amount", + "value": "remaining available amount" + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "remaining RMB due" + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/en_US/media/ic_dialog_phone.png b/MultiFinancialManagement/features/home/src/main/resources/en_US/media/ic_dialog_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..9d681984df2706f2e5553e2b2888bcc5eaed2672 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/en_US/media/ic_dialog_phone.png differ diff --git a/MultiFinancialManagement/features/home/src/main/resources/zh_CN/element/string.json b/MultiFinancialManagement/features/home/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..09427c29ac2ca5cee06c29fe3219bb4082c8dddd --- /dev/null +++ b/MultiFinancialManagement/features/home/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,224 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "深圳" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "home_account", + "value": "账户" + }, + { + "name": "home_details", + "value": "明细" + }, + { + "name": "home_transfers", + "value": "转账" + }, + { + "name": "home_loans", + "value": "贷款" + }, + { + "name": "home_fund_investment", + "value": "基金投资" + }, + { + "name": "home_wealth_products", + "value": "理财产品" + }, + { + "name": "home_cards", + "value": "信用卡" + }, + { + "name": "home_notes", + "value": "账单" + }, + { + "name": "home_quick_profit", + "value": "速盈" + }, + { + "name": "home_precious_metals", + "value": "贵金属" + }, + { + "name": "home_deposits", + "value": "存款产品" + }, + { + "name": "home_payment", + "value": "缴费" + }, + { + "name": "home_quick_loan", + "value": "快贷" + }, + { + "name": "home_more", + "value": "更多" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "财富精选" + }, + { + "name": "account_all_info", + "value": "账户总览" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "昨日收益+333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "活期+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "投资" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "本月剩余应还" + }, + { + "name": "prompt_message", + "value": "备老趁早,养老无忧,新用户立享3重礼>>" + }, + { + "name": "liabilities_name", + "value": "负债" + }, + { + "name": "saving_card", + "value": "储蓄卡" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "活期存款" + }, + { + "name": "day_day_treasure", + "value": "日日宝" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "昨日收益1.33" + }, + { + "name": "investment_wealth", + "value": "理财" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "半年宝" + }, + { + "name": "earnings_holding_positions", + "value": "持仓收益 " + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "最近可赎日:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "持仓金额" + }, + { + "name": "fund_name", + "value": "基金" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX指数C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "昨日收益" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "信用卡个人消费账户" + }, + { + "name": "remaining_available_amount", + "value": "剩余可用额度 " + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "剩余应还人民币 " + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/home/src/main/resources/zh_CN/media/ic_dialog_phone.png b/MultiFinancialManagement/features/home/src/main/resources/zh_CN/media/ic_dialog_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e5d17069296ea05eb83e31de7a2ac53aede289 Binary files /dev/null and b/MultiFinancialManagement/features/home/src/main/resources/zh_CN/media/ic_dialog_phone.png differ diff --git a/MultiFinancialManagement/features/transaction/Index.ets b/MultiFinancialManagement/features/transaction/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4539903430c121861dd9c076f55029e0ff9d660 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/Index.ets @@ -0,0 +1 @@ +export { TransactionComponent } from './src/main/ets/view/TransactionComponent'; \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/build-profile.json5 b/MultiFinancialManagement/features/transaction/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiFinancialManagement/features/transaction/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/hvigorfile.ts b/MultiFinancialManagement/features/transaction/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/features/transaction/obfuscation-rules.txt b/MultiFinancialManagement/features/transaction/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/features/transaction/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/oh-package.json5 b/MultiFinancialManagement/features/transaction/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5ee1df01e14a3989cb6b81ac615c0c8e68c682e4 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "transaction", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/MultiFinancialManagement/features/transaction/src/main/ets/constants/TransactionConstants.ets b/MultiFinancialManagement/features/transaction/src/main/ets/constants/TransactionConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f9476f182fa2bdb2d47914bc3bb5a6198acd3a5 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/ets/constants/TransactionConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Transaction constants for transaction feature. + */ +export class TransactionConstants { + /** + * Row space. + */ + static readonly ROW_SPACE: number = 12; + + /** + * Purchase rates. + */ + static readonly RATE_VALUE: number = 0; + + /** + * Rate confirmation date. + */ + static readonly RATE_MOUTH: number = 8; + + /** + * Rate confirmation date. + */ + static readonly RATE_DAY: number = 18; +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/ets/view/TransactionComponent.ets b/MultiFinancialManagement/features/transaction/src/main/ets/view/TransactionComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..9047f079d4df03896137b9cc7e40ef82edc943dc --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/ets/view/TransactionComponent.ets @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { window } from '@kit.ArkUI'; +import { CommonConstants, FundDetail } from '@ohos/basic'; +import { TransactionConstants } from '../constants/TransactionConstants'; + +@Component +export struct TransactionComponent { + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State indexList: number = 0; + @StorageProp('allFund') fundInfo: FundDetail[] = []; + @StorageProp('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + NavDestination() { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.financial_purchase')) + .fontSize($r('app.float.title_size')) + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Row() { + Text(this.fundInfo[this.indexList].name) + .fontSize($r('app.float.fund_text_size')) + .fontColor($r('app.color.fund_text')) + .lineHeight($r('app.float.fund_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + Text(this.fundInfo[this.indexList].amplitude) + .fontSize($r('app.float.amplitude_size')) + .fontColor($r('app.color.amplitude_color')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.fund_text_padding_top') + }) + + Row({ space: TransactionConstants.ROW_SPACE }) { + Text($r('app.string.fixed_investment')) + .textTypeExtend() + + Text($r('app.string.fund_type')) + .textTypeExtend() + + Text($r('app.string.risk_level')) + .textTypeExtend() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.type_padding_top'), + bottom: $r('app.float.type_padding_bottom') + }) + + Row() { + Text($r('app.string.transaction_account')) + .fontSize($r('app.float.account_size')) + .fontColor($r('app.color.account_text')) + .lineHeight($r('app.float.account_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Row() { + Text($r('app.string.payment_account')) + .fontSize($r('app.float.payment_size')) + .fontColor($r('app.color.common_text')) + .lineHeight($r('app.float.payment_text_height')) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_width')) + .height($r('app.float.arrow_height')) + .fillColor($r('app.color.arrow_right')) + .margin({ + left: $r('app.float.arrow_margin_left') + }) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_height')) + .backgroundColor(Color.White) + .padding({ + top: $r('app.float.account_padding_top_bottom'), + bottom: $r('app.float.account_padding_top_bottom'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Row() { + Text($r('app.string.available_balance')) + .fontSize($r('app.float.available_size')) + .fontColor($r('app.color.available_text')) + .lineHeight($r('app.float.available_height')) + Image($r('app.media.ic_about')) + .width($r('app.float.about_image')) + .height($r('app.float.about_image')) + .margin({ + left: $r('app.float.about_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.End) + .height($r('app.float.available_row_height')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Column() { + Row() { + Text($r('app.string.purchase_amount')) + .fontSize($r('app.float.purchase_size')) + .fontColor($r('app.color.purchase_text')) + .lineHeight($r('app.float.purchase_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.transaction_rules')) + .fontSize($r('app.float.rules_size')) + .fontColor($r('app.color.rules_text')) + .lineHeight($r('app.float.rules_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + + Row() { + Text($r('app.string.money_symbol')) + .fontSize($r('app.float.symbol_size')) + TextInput() + .enableKeyboardOnFocus(false) + .fontSize($r('app.float.symbol_size')) + .backgroundColor(Color.White) + .layoutWeight(1) + .textAlign(TextAlign.End) + .type(InputType.Number) + .margin({ + left: $r('app.float.input_margin'), + right: $r('app.float.input_margin') + }) + Button($r('app.string.buy_all')) + .backgroundColor($r('app.color.button_buy_background')) + .width($r('app.float.button_buy_width')) + .height($r('app.float.button_buy_height')) + .fontSize($r('app.float.button_buy_size')) + .fontColor($r('app.color.button_buy')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + + Row() { + Text($r('app.string.confirm_share_prompt', TransactionConstants.RATE_VALUE, + TransactionConstants.RATE_MOUTH, TransactionConstants.RATE_DAY)) + .fontSize($r('app.float.confirm_size')) + .fontColor($r('app.color.common_text')) + .lineHeight($r('app.float.confirm_text_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ + top: $r('app.float.confirm_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + .border({ + width: { + top: $r('app.float.confirm_border_width') + }, + color: $r('app.color.confirm_border') + }) + } + .height($r('app.float.buy_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + top: $r('app.float.buy_info_padding'), + bottom: $r('app.float.buy_info_padding') + }) + + Row() { + Text($r('app.string.recommendation_no')) + .fontSize($r('app.float.recommendation_size')) + .fontColor($r('app.color.recommendation_text')) + .lineHeight($r('app.float.recommendation_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + TextInput({ placeholder: $r('app.string.recommendation_optional') }) + .fontSize($r('app.float.recommendation_size')) + .backgroundColor(Color.White) + .layoutWeight(1) + .textAlign(TextAlign.End) + .type(InputType.Number) + .padding(0) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.recommendation_height')) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + .margin({ + top: $r('app.float.recommendation_margin'), + bottom: $r('app.float.recommendation_margin') + }) + + Column() { + Row() { + Text($r('app.string.transaction_read')) + .fontSize($r('app.float.read_size')) + .fontColor($r('app.color.common_text')) + .lineHeight($r('app.float.read_text_height')) + .margin({ + right: $r('app.float.read_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_right_width')) + .height($r('app.float.common_image_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Button($r('app.string.transaction_button')) + .backgroundColor($r('app.color.button_background')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .constraintSize({ + minWidth: $r('app.float.button_min_width'), + maxWidth: $r('app.float.button_max_width') + }) + .height($r('app.float.button_height')) + } + .layoutWeight(1) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.read_padding_top'), + bottom: $r('app.float.read_padding_bottom') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundColor($r('app.color.transaction_background')) + } + .hideTitleBar(true) + .onShown(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#F7F7F7' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + .onHidden(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#00ffffff' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + } +} + +@Extend(Text) +function textTypeExtend() { + .fontSize($r('app.float.type_text_size')) + .fontColor($r('app.color.type_text')) + .backgroundColor($r('app.color.type_text_background')) + .padding({ + left: $r('app.float.type_text_padding_lr'), + right: $r('app.float.type_text_padding_lr'), + top: $r('app.float.type_text_padding_tb'), + bottom: $r('app.float.type_text_padding_tb') + }) +} diff --git a/MultiFinancialManagement/features/transaction/src/main/module.json5 b/MultiFinancialManagement/features/transaction/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0366a6ce273b4a73707ed62e0f0f88e40342700b --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "transaction", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/element/color.json b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..409a4b6c8389654b8bc8105cb5e5027565c67ab8 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/color.json @@ -0,0 +1,72 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "fund_text", + "value": "#182431" + }, + { + "name": "amplitude_color", + "value": "#66000000" + }, + { + "name": "account_text", + "value": "#182431" + }, + { + "name": "common_text", + "value": "#99000000" + }, + { + "name": "arrow_right", + "value": "#e6000000" + }, + { + "name": "available_text", + "value": "#99000000" + }, + { + "name": "purchase_text", + "value": "#182431" + }, + { + "name": "rules_text", + "value": "#0A59F7" + }, + { + "name": "button_buy_background", + "value": "#0d000000" + }, + { + "name": "button_buy", + "value": "#0A59F7" + }, + { + "name": "confirm_border", + "value": "#1a000000" + }, + { + "name": "recommendation_text", + "value": "#182431" + }, + { + "name": "button_background", + "value": "#0A59F7" + }, + { + "name": "transaction_background", + "value": "#F7F7F7" + }, + { + "name": "type_text", + "value": "#1F69FF" + }, + { + "name": "type_text_background", + "value": "#0d1f69ff" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/element/float.json b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..2393c2a2f374390f4874e6d4f6c5f28f364b51bf --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/float.json @@ -0,0 +1,224 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "title_size", + "value": "18fp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "fund_text_size", + "value": "16fp" + }, + { + "name": "fund_text_height", + "value": "22vp" + }, + { + "name": "amplitude_size", + "value": "12fp" + }, + { + "name": "fund_text_padding_top", + "value": "29vp" + }, + { + "name": "type_padding_top", + "value": "14vp" + }, + { + "name": "type_padding_bottom", + "value": "17vp" + }, + { + "name": "account_size", + "value": "16fp" + }, + { + "name": "account_text_height", + "value": "22vp" + }, + { + "name": "payment_size", + "value": "14fp" + }, + { + "name": "payment_text_height", + "value": "19vp" + }, + { + "name": "arrow_width", + "value": "6.74vp" + }, + { + "name": "arrow_height", + "value": "12.81vp" + }, + { + "name": "arrow_margin_left", + "value": "14vp" + }, + { + "name": "account_height", + "value": "80vp" + }, + { + "name": "account_padding_top_bottom", + "value": "29vp" + }, + { + "name": "available_size", + "value": "14fp" + }, + { + "name": "available_height", + "value": "19vp" + }, + { + "name": "about_image", + "value": "22vp" + }, + { + "name": "about_margin_left", + "value": "13vp" + }, + { + "name": "available_row_height", + "value": "48vp" + }, + { + "name": "purchase_size", + "value": "16fp" + }, + { + "name": "purchase_text_height", + "value": "22vp" + }, + { + "name": "rules_size", + "value": "14fp" + }, + { + "name": "rules_text_height", + "value": "19vp" + }, + { + "name": "symbol_size", + "value": "36fp" + }, + { + "name": "input_margin", + "value": "10vp" + }, + { + "name": "button_buy_width", + "value": "80vp" + }, + { + "name": "button_buy_height", + "value": "28vp" + }, + { + "name": "button_buy_size", + "value": "12fp" + }, + { + "name": "confirm_size", + "value": "14vp" + }, + { + "name": "confirm_text_height", + "value": "19vp" + }, + { + "name": "confirm_padding_top", + "value": "14.93vp" + }, + { + "name": "confirm_border_width", + "value": "0.5vp" + }, + { + "name": "buy_info_height", + "value": "176vp" + }, + { + "name": "buy_info_padding", + "value": "13vp" + }, + { + "name": "recommendation_size", + "value": "16fp" + }, + { + "name": "recommendation_text_height", + "value": "22vp" + }, + { + "name": "recommendation_height", + "value": "48vp" + }, + { + "name": "recommendation_margin", + "value": "12vp" + }, + { + "name": "read_size", + "value": "14fp" + }, + { + "name": "read_text_height", + "value": "21vp" + }, + { + "name": "read_margin_right", + "value": "16vp" + }, + { + "name": "arrow_right_width", + "value": "12vp" + }, + { + "name": "button_height", + "value": "40vp" + }, + { + "name": "read_padding_top", + "value": "16vp" + }, + { + "name": "read_padding_bottom", + "value": "48vp" + }, + { + "name": "type_text_size", + "value": "10fp" + }, + { + "name": "type_text_padding_lr", + "value": "4vp" + }, + { + "name": "type_text_padding_tb", + "value": "1vp" + }, + { + "name": "button_min_width", + "value": "328vp" + }, + { + "name": "button_max_width", + "value": "604vp" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/element/string.json b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9126b5ea58c77ee817f0a076f44299eab4884387 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "financial_purchase", + "value": "Financial purchase" + }, + { + "name": "transaction_account", + "value": "account" + }, + { + "name": "payment_account", + "value": "payment account" + }, + { + "name": "available_balance", + "value": "Available Balance" + }, + { + "name": "purchase_amount", + "value": "Purchase Amount" + }, + { + "name": "transaction_rules", + "value": "transaction rules" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "Buy it all" + }, + { + "name": "confirm_share_prompt", + "value": "Buy %d rate, share confirmation is expected on %d %d" + }, + { + "name": "recommendation_no", + "value": "Recommendation No" + }, + { + "name": "recommendation_optional", + "value": "optional" + }, + { + "name": "transaction_read", + "value": "Read and agree to the Product Description, Risk Disclosure, and other agreements." + }, + { + "name": "transaction_button", + "value": "Agree to the next step of the agreement" + }, + { + "name": "fund_type", + "value": "Currency type" + }, + { + "name": "risk_level", + "value": "R3-Medium Risk" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_about.png b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_about.png new file mode 100644 index 0000000000000000000000000000000000000000..d9ec044e0e3ac4d63aa394705db4e05f22d54245 Binary files /dev/null and b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_about.png differ diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cc0f2ad4fd08ee0b7340c787910fd3723a36b7d --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_back.svg b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_comments.svg b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/icon.png b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/base/media/setting.jpeg b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiFinancialManagement/features/transaction/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/en_US/element/string.json b/MultiFinancialManagement/features/transaction/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9126b5ea58c77ee817f0a076f44299eab4884387 --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/en_US/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "financial_purchase", + "value": "Financial purchase" + }, + { + "name": "transaction_account", + "value": "account" + }, + { + "name": "payment_account", + "value": "payment account" + }, + { + "name": "available_balance", + "value": "Available Balance" + }, + { + "name": "purchase_amount", + "value": "Purchase Amount" + }, + { + "name": "transaction_rules", + "value": "transaction rules" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "Buy it all" + }, + { + "name": "confirm_share_prompt", + "value": "Buy %d rate, share confirmation is expected on %d %d" + }, + { + "name": "recommendation_no", + "value": "Recommendation No" + }, + { + "name": "recommendation_optional", + "value": "optional" + }, + { + "name": "transaction_read", + "value": "Read and agree to the Product Description, Risk Disclosure, and other agreements." + }, + { + "name": "transaction_button", + "value": "Agree to the next step of the agreement" + }, + { + "name": "fund_type", + "value": "Currency type" + }, + { + "name": "risk_level", + "value": "R3-Medium Risk" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/features/transaction/src/main/resources/zh_CN/element/string.json b/MultiFinancialManagement/features/transaction/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a2bffc5f9001dc9a0192349483668da62aea744d --- /dev/null +++ b/MultiFinancialManagement/features/transaction/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "financial_purchase", + "value": "理财购买" + }, + { + "name": "transaction_account", + "value": "账户" + }, + { + "name": "payment_account", + "value": "付款账户 (0012)" + }, + { + "name": "available_balance", + "value": "可用余额 ¥ 34,567.89" + }, + { + "name": "purchase_amount", + "value": "购买金额" + }, + { + "name": "transaction_rules", + "value": "交易规则" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "全部买入" + }, + { + "name": "confirm_share_prompt", + "value": "购买%d费率,预计%d月%d日确认份额" + }, + { + "name": "recommendation_no", + "value": "推荐号" + }, + { + "name": "recommendation_optional", + "value": "选填" + }, + { + "name": "transaction_read", + "value": "阅读并同意《产品说明书》《风险揭示书》等协议" + }, + { + "name": "transaction_button", + "value": "同意协议下一步" + }, + { + "name": "fund_type", + "value": "货币型" + }, + { + "name": "risk_level", + "value": "R3-中风险" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/hvigor/hvigor-config.json5 b/MultiFinancialManagement/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 --- /dev/null +++ b/MultiFinancialManagement/hvigor/hvigor-config.json5 @@ -0,0 +1,5 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/oh-package.json5 b/MultiFinancialManagement/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..937148751f46d6dc971bb87e8fdd35911931dc54 --- /dev/null +++ b/MultiFinancialManagement/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + }, + "author": "", + "name": "multifinancialmanagement", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiFinancialManagement/product/phone/build-profile.json5 b/MultiFinancialManagement/product/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..197e83c1b9504b12a3837e0189185479662cad4b --- /dev/null +++ b/MultiFinancialManagement/product/phone/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/hvigorfile.ts b/MultiFinancialManagement/product/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiFinancialManagement/product/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiFinancialManagement/product/phone/obfuscation-rules.txt b/MultiFinancialManagement/product/phone/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1dfa0bd175984dc49e641436aa67b1de1b8abeb --- /dev/null +++ b/MultiFinancialManagement/product/phone/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/oh-package.json5 b/MultiFinancialManagement/product/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a777161c5d81f1f467c7ff5f9f2c123e7a151d4 --- /dev/null +++ b/MultiFinancialManagement/product/phone/oh-package.json5 @@ -0,0 +1,16 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic", + "@ohos/home": "file:../../features/home", + "@ohos/fund": "file:../../features/fund", + "@ohos/fundComparison": "file:../../features/fundComparison" + } +} diff --git a/MultiFinancialManagement/product/phone/src/main/ets/entryability/EntryAbility.ets b/MultiFinancialManagement/product/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7dbce920e78486514c9cc450e3718ce8f5bb4c1 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UIAbility, Want, AbilityConstant } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { display, window } from '@kit.ArkUI'; +import { CommonConstants } from '@ohos/basic'; + +export default class EntryAbility extends UIAbility { + private windowObj?: window.Window; + + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow().then((data: window.Window) => { + this.windowObj = data; + this.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', (windowSize: window.Size) => { + this.updateBreakpoint(windowSize.width); + }) + }) + + windowStage.loadContent('pages/Index', (err: BusinessError, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + private updateBreakpoint(windowWidth: number): void{ + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < CommonConstants.BREAK_POINTS_VALUE_NUMBER[1]) { + curBp = CommonConstants.BREAK_POINT_SM; + } else if (windowWidthVp < CommonConstants.BREAK_POINTS_VALUE_NUMBER[2]) { + curBp = CommonConstants.BREAK_POINT_MD; + } else { + curBp = CommonConstants.BREAK_POINT_LG; + } + AppStorage.setOrCreate('breakPoint', curBp); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/MultiFinancialManagement/product/phone/src/main/ets/pages/Index.ets b/MultiFinancialManagement/product/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fae3efd2ed719371248b85a9fa87633c3cf736f4 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { window } from '@kit.ArkUI'; +import { BreakpointUtil, CommonConstants, RouterConstants } from '@ohos/basic'; +import { AccountPage, AdvertisementDialog, HomeComponent } from '@ohos/home'; +import { Funding, FundingDetail, TrendsPage } from '@ohos/fund'; +import { ComparisonDetailPage, ComparisonInfo } from '@ohos/fundComparison'; + +@Entry +@Component + // [Start init_pop_custom_style] +struct Index { + // [StartExclude init_pop_custom_style] + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + @State currentTabIndex: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @State backgroundImageY: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); + // [EndExclude init_pop_custom_style] + dialogController: CustomDialogController = new CustomDialogController({ + builder: AdvertisementDialog(), + backgroundColor: $r('app.color.dialog_background'), + alignment: DialogAlignment.Center, + maskColor: $r('app.color.dialog_mask'), + customStyle: true + }); + + aboutToAppear() { + this.dialogController.open(); + } + // [StartExclude init_pop_custom_style] + onPageShow() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let area = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + let topHeight = px2vp(area.topRect.height); + let bottomArea = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + let bottom = px2vp(bottomArea.bottomRect.height); + if (topHeight > 0) { + windowStage.setWindowLayoutFullScreen(true); + AppStorage.setOrCreate('avoidArea', topHeight); + AppStorage.setOrCreate('bottom', bottom); + } + }); + } + + onPageHide() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + if (this.topHeight > 0) { + windowStage.setWindowLayoutFullScreen(false); + } + }); + } + + getTabBarColor(index: number, currentTabIndex: number, breakPoint: string): ResourceColor { + if (this.backgroundImageY < -20 && this.currentTabIndex === 0 && index === 0) { + return $r('app.color.tab_choose_image') + } else if (index === 0 && breakPoint === CommonConstants.BREAK_POINT_LG) { + return currentTabIndex === index ? Color.White : $r('app.color.tab_un_image'); + } + return currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image'); + } + + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column() { + Image(icon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + Text(title) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column() { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + Text(title) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + } + } + + @Builder + PagesMap(name: string, param?: object) { + if (name === RouterConstants.FUNDING_URL) { + Funding() + } else if (name === RouterConstants.ACCOUNT_PAGE_URL) { + NavDestination() { + AccountPage() + } + .hideTitleBar(true) + .onWillShow(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + }) + } else if (name === RouterConstants.FUNDING_DETAIL_URL) { + FundingDetail({ index: (param as Record)['listIndex'] }) + } else if (name === RouterConstants.TRENDS_PAGE_URL) { + TrendsPage({ name: (param as Record)['name'] }) + } else if (name === RouterConstants.COMPARISON_PAGE_URL) { + NavDestination() { + ComparisonDetailPage({ chooseComparison: (param as Record)['chooseComparison'] }) + } + .hideTitleBar(true) + .onWillShow(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + }) + } + } + + build() { + Navigation(this.pageIndexInfos) { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + HomeComponent({ + currentPoint: this.breakPoint, + scrollY: this.backgroundImageY + }) + .margin({ + top: this.topHeight + }) + } + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + .backgroundColor(Color.White) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + .backgroundColor(Color.White) + + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + .backgroundColor(Color.White) + + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) + .backgroundColor(Color.White) + } + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.TAB_HEIGHT_PERCENT : $r('app.float.tab_bar_height')) + .backgroundImage(this.currentTabIndex === 0 ? new BreakpointUtil({ + sm: $r('app.media.ic_home_phone_background'), + md: $r('app.media.ic_home_fold_background'), + lg: $r('app.media.ic_home_tablet_background') + }).getValue(this.breakPoint) : $r('app.media.ic_home_not_background')) + .backgroundImageSize(ImageSize.Contain) + .backgroundImagePosition({ + y: this.backgroundImageY + }) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) + .padding({ + bottom: this.bottom + }) + } + } + } + } + .mode(NavigationMode.Stack) + .navDestination(this.PagesMap) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .hideTitleBar(true) + .hideToolBar(true) + } + // [EndExclude init_pop_custom_style] +} +// [End init_pop_custom_style] \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/module.json5 b/MultiFinancialManagement/product/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3ef13f42c4677c39fe11d9c046a48dabf137bd76 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/module.json5 @@ -0,0 +1,40 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 360, + "minWindowHeight": 720, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/element/color.json b/MultiFinancialManagement/product/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1e87cfd0b724301369c18bd3c466acc10a2d4506 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/element/color.json @@ -0,0 +1,40 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "dialog_background", + "value": "#00FFFFFF" + }, + { + "name": "dialog_mask", + "value": "#99000000" + }, + { + "name": "home_background", + "value": "#F7F7F7" + }, + { + "name": "bar_background", + "value": "#2ef1f3f5" + }, + { + "name": "tab_choose_image", + "value": "#0A59F7" + }, + { + "name": "tab_un_image", + "value": "#33000000" + }, + { + "name": "tab_choose_text", + "value": "#0A59F7" + }, + { + "name": "tab_un_text", + "value": "#33000000" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/element/float.json b/MultiFinancialManagement/product/phone/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..2b137e31ba0c2c560780eafe7399c52ac13596c0 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/element/float.json @@ -0,0 +1,28 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "tab_text_size", + "value": "10fp" + }, + { + "name": "tab_text_height", + "value": "14vp" + }, + { + "name": "tab_bar_width", + "value": "96vp" + }, + { + "name": "tab_bar_height", + "value": "56vp" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/element/string.json b/MultiFinancialManagement/product/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c2919cc646dd8135a51e28c40dd33557df4d6ada --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiFinancialManagement" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/background.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/background.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/foreground.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/foreground.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fold_background.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fold_background.png new file mode 100644 index 0000000000000000000000000000000000000000..2ecbe63c76052be4f6f9cbb2dafd0e62238eff6d Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fold_background.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fortunes.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fortunes.svg new file mode 100644 index 0000000000000000000000000000000000000000..27236e9117514e1e9fff77ba9278728504735003 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_fortunes.svg @@ -0,0 +1,11 @@ + + + 财富 + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine.svg new file mode 100644 index 0000000000000000000000000000000000000000..62a5b62bce8cbec51c56c1db00f7317e4e9a52be --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..dbeec6ef94878c69058ce80156916747920a5102 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_not_background.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_not_background.png new file mode 100644 index 0000000000000000000000000000000000000000..fb33baf308415ec4d46654cedbdaed9eaf59ffab Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_not_background.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_phone_background.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_phone_background.png new file mode 100644 index 0000000000000000000000000000000000000000..dba3b16cfcc0687ad7d0270fe96b339fb69abf83 Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_phone_background.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_tablet_background.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_tablet_background.png new file mode 100644 index 0000000000000000000000000000000000000000..631fd5f624d63d7e4b96e81cc32b8167f182911d Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_home_tablet_background.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_life_filled.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1aba5b5eb63534290b53c06fe7815720796b052 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..965b18a454a95133c73c7a3b9b917e538c1a217c --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,20 @@ + + + 信用卡 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_home_filled.svg b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..deb4371a0ec1c00f635cb10894fb3eefcf8a672f --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,20 @@ + + + 首页 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/icon.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/layered_image.json b/MultiFinancialManagement/product/phone/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/media/startIcon.png b/MultiFinancialManagement/product/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/MultiFinancialManagement/product/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiFinancialManagement/product/phone/src/main/resources/base/profile/main_pages.json b/MultiFinancialManagement/product/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiFinancialManagement/product/phone/src/main/resources/en_US/element/string.json b/MultiFinancialManagement/product/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c2919cc646dd8135a51e28c40dd33557df4d6ada --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiFinancialManagement" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/product/phone/src/main/resources/zh_CN/element/string.json b/MultiFinancialManagement/product/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d51095329edda1f8c1c15c2925d8fd7a8c28f007 --- /dev/null +++ b/MultiFinancialManagement/product/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "银行理财" + }, + { + "name": "tab_bar_home", + "value": "首页" + }, + { + "name": "tab_bar_card", + "value": "信用卡" + }, + { + "name": "tab_bar_fortunes", + "value": "财富" + }, + { + "name": "tab_bar_life", + "value": "生活" + }, + { + "name": "tab_bar_mine", + "value": "我的" + } + ] +} \ No newline at end of file diff --git a/MultiFinancialManagement/screenshots/device/foldable.en.png b/MultiFinancialManagement/screenshots/device/foldable.en.png new file mode 100644 index 0000000000000000000000000000000000000000..2ec5410131d095dd77a458e859947e232eddf591 Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/foldable.en.png differ diff --git a/MultiFinancialManagement/screenshots/device/foldable.png b/MultiFinancialManagement/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..5b315bae9fc7de5a96968d9e9f09023d5cfced3d Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/foldable.png differ diff --git a/MultiFinancialManagement/screenshots/device/pad.en.png b/MultiFinancialManagement/screenshots/device/pad.en.png new file mode 100644 index 0000000000000000000000000000000000000000..e224dfdd7263abdf40d2974bcd11df3aad5d1c8a Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/pad.en.png differ diff --git a/MultiFinancialManagement/screenshots/device/pad.png b/MultiFinancialManagement/screenshots/device/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..05f7ac6ebb4e928e744ce74b746b88360bad28b6 Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/pad.png differ diff --git a/MultiFinancialManagement/screenshots/device/phone.en.png b/MultiFinancialManagement/screenshots/device/phone.en.png new file mode 100644 index 0000000000000000000000000000000000000000..2db6f9d1cb660a7a87ab9f9b928dc0fd1166fd0f Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/phone.en.png differ diff --git a/MultiFinancialManagement/screenshots/device/phone.png b/MultiFinancialManagement/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..bcc886198a0c16f6b266794e522072ca14007685 Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/phone.png differ diff --git a/MultiFinancialManagement/screenshots/device/run.png b/MultiFinancialManagement/screenshots/device/run.png new file mode 100644 index 0000000000000000000000000000000000000000..7655fa7e041bb067e028029d820bd2d320e2cd83 Binary files /dev/null and b/MultiFinancialManagement/screenshots/device/run.png differ diff --git a/MultiPictureBeautification/AppScope/app.json5 b/MultiPictureBeautification/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..077baae64fa0358a4481e0a3f9a3e47b98a96639 --- /dev/null +++ b/MultiPictureBeautification/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.multipicturebeautification", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/MultiPictureBeautification/AppScope/resources/base/element/string.json b/MultiPictureBeautification/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..680de91f2f730e1f903ff5e704ae32d969149910 --- /dev/null +++ b/MultiPictureBeautification/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiPictureBeautification" + } + ] +} diff --git a/MultiPictureBeautification/AppScope/resources/base/media/app_icon.png b/MultiPictureBeautification/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiPictureBeautification/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiPictureBeautification/LICENSE b/MultiPictureBeautification/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/MultiPictureBeautification/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + + 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/MultiPictureBeautification/README.en.md b/MultiPictureBeautification/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..9e0f8cea9ce9c8e295d0d2991a359c7bc1baea70 --- /dev/null +++ b/MultiPictureBeautification/README.en.md @@ -0,0 +1,42 @@ +# Image Beautification + +### Introduction + +Learn to implement an image beautification app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. + +#### Description + +This codelab implements an image beautification app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. It uses the three-layer project architecture for code reuse and tailors the pages to different device sizes such as mobile phones, foldable phones, and PC/2-in-1 devices. +The following figure shows the effect on the mobile phone. + +![](screenshots/device/phone_en.png) + +The following figure shows the effect on the foldable phone in unfolded state. + +![](screenshots/device/foldable_en.png) + +The following figure shows the effect of the tablet and PC/2-in-1 device. + +![](screenshots/device/pad_en.png) + +#### Concepts + +- One-time development for multi-device deployment: It enables you to develop and release one set of project code for deployment on multiple devices as demanded. This feature enables you to efficiently develop applications that are compatible with multiple devices while providing distributed user experiences for cross-device transferring, migration, and collaboration. +- Area change event: It is triggered when the component's size, position, or any other attribute that may affect its display area changes. +- PinchGesture: It is used to trigger a pinch gesture, which requires two to five fingers with a minimum 5 vp distance between the fingers. + +#### Permissions + +N/A. + +#### How to Use + +- Install and open an app on a mobile phone, foldable phone, tablet, or PC/2-in-1 device. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +- Tap the edit or album icon to access the photo editing page or album page. + +#### Constraints + +1. The sample is only supported on Huawei phones with standard systems. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later. +3. DevEco Studio: DevEco Studio 5.0.0 Release or later. +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later. diff --git a/MultiPictureBeautification/README.md b/MultiPictureBeautification/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6ba0d6478089d51d9adfe07aefc4725ba90d2d36 --- /dev/null +++ b/MultiPictureBeautification/README.md @@ -0,0 +1,42 @@ +# 一次开发,多端部署-图片美化 + +### 简介 + +基于自适应和响应式布局,实现一次开发,多端部署-图片美化。 + +#### 介绍 + +本篇Codelab基于自适应布局和响应式布局,实现一次开发,多端部署的即时通讯页面。通过“三层工程架构”实现代码复用,并根据手机、折叠屏以及PC/2in1不同的设备尺寸设计对应页面。 +手机效果如图所示: + +![](screenshots/device/phone.png) + +折叠屏展开态效果如图所示: + +![](screenshots/device/foldable.png) + +平板,PC/2in1效果如图所示: + +![](screenshots/device/pad.png) + +#### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 组件区域变化事件:组件区域变化事件指组件显示的尺寸、位置等发生变化时触发的事件。 +- 双指缩放:用于触发捏合手势,触发捏合手势的最少手指为2指,最大为5指,最小识别距离为5vp。 + +#### 相关权限 + +不涉及。 + +#### 使用说明 + +- 分别在手机、折叠屏、平板、PC/2in1安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +- 点击编辑、相册图标将分别进入图片编辑页面,相册页面。 + +#### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 \ No newline at end of file diff --git a/MultiPictureBeautification/build-profile.json5 b/MultiPictureBeautification/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ee4c7b2cff0e6b5e33f97a7b0daf0477fc2f8549 --- /dev/null +++ b/MultiPictureBeautification/build-profile.json5 @@ -0,0 +1,85 @@ +{ + "app": { + "signingConfigs": [ + + ], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./product/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./commons/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "pictureView", + "srcPath": "./features/pictureView", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "albumView", + "srcPath": "./features/albumView", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "pictureEdit", + "srcPath": "./features/pictureEdit", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/BuildProfile.ets b/MultiPictureBeautification/commons/base/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4 --- /dev/null +++ b/MultiPictureBeautification/commons/base/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/Index.ets b/MultiPictureBeautification/commons/base/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d5fa6ce2e6fddc516cf7beb6378e72c520049b8 --- /dev/null +++ b/MultiPictureBeautification/commons/base/Index.ets @@ -0,0 +1,3 @@ +export { BaseConstants } from './src/main/ets/constants/BaseConstants' +export { BreakpointConstants } from './src/main/ets/constants/BreakpointConstants' +export { BreakpointType } from './src/main/ets/utils/BreakpointType' \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/build-profile.json5 b/MultiPictureBeautification/commons/base/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiPictureBeautification/commons/base/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/hvigorfile.ts b/MultiPictureBeautification/commons/base/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiPictureBeautification/commons/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiPictureBeautification/commons/base/obfuscation-rules.txt b/MultiPictureBeautification/commons/base/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiPictureBeautification/commons/base/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/oh-package.json5 b/MultiPictureBeautification/commons/base/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..47db8a72bb9acfc968637d504dc39688765e7e31 --- /dev/null +++ b/MultiPictureBeautification/commons/base/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": {} +} diff --git a/MultiPictureBeautification/commons/base/src/main/ets/constants/BaseConstants.ets b/MultiPictureBeautification/commons/base/src/main/ets/constants/BaseConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b005fe234feddaeff2210827e3570fa75443c3f6 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/ets/constants/BaseConstants.ets @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2024 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 class BaseConstants { + /** + * Component size. + */ + static readonly FULL_PERCENT: string = '100%'; + static readonly FULL_SIZE: string = '100%'; + static readonly FULL_HEIGHT: string = '100%'; + static readonly FULL_WIDTH: string = '100%'; + static readonly NINETY_WIDTH_PERCENT: string = '90%'; + static readonly IMAGE_ONE_WIDTH_SM: string = '66.6%'; + static readonly IMAGE_ONE_WIDTH_MD: string = '63.8%'; + static readonly IMAGE_ONE_WIDTH_LG: string = '32.1%'; + static readonly TAB_PADDING_TOP: string = '28.6%' + static readonly TAB_PADDING_BOTTOM: string = '28.6%' + static readonly HOME_LIST_WIDTH: string = '37%' + static readonly APPLET_LIST_WIDTH: string = '37%' + static readonly IMAGE_ONE_ASPECT_RATIO: number = 1.33; + static readonly SMALL_MINI_FONT_SIZE: Resource = $r('app.float.smaller_mini_font_size'); + /** + * Text property. + */ + static readonly FONT_FAMILY_SEMI_BOLD: Resource = $r('app.float.font_family_semi_bold'); + static readonly FONT_FAMILY_NORMAL: Resource = $r('app.float.font_family_normal'); + static readonly FONT_FAMILY_BOLD: Resource = $r('app.float.font_family_bold'); + static readonly FONT_FAMILY_MEDIUM: Resource = $r('app.float.font_family_medium'); + static readonly FONT_WEIGHT_SEVEN: number = 700; + static readonly FONT_WEIGHT_SIX: number = 600; + static readonly FONT_WEIGHT_FIVE: number = 500; + static readonly FONT_WEIGHT_FOUR: number = 400; + static readonly FONT_SIZE_TEN: Resource = $r('app.float.font_size_ten'); + static readonly FONT_SIZE_ELEVEN: Resource = $r('app.float.font_size_eleven'); + static readonly FONT_SIZE_TWELVE: Resource = $r('app.float.font_size_twelve'); + static readonly FONT_SIZE_FOURTEEN: Resource = $r('app.float.font_size_fourteen'); + static readonly FONT_SIZE_SIXTEEN: Resource = $r('app.float.font_size_sixteen'); + static readonly FONT_SIZE_EIGHTEEN: Resource = $r('app.float.font_size_eighteen'); + static readonly FONT_SIZE_TWENTY: Resource = $r('app.float.font_size_twenty'); + static readonly FONT_SIZE_TWENTY_FOUR: Resource = $r('app.float.font_size_twenty_four'); + static readonly FONT_SIZE_THIRTY_TWO: Resource = $r('app.float.font_size_thirty_two'); + /** + * Application about. + */ + static readonly SPLIT_DOCUMENT_SCREEN = false; + static readonly SPLIT_APPLET_SCREEN = false; + /** + * Flex about. + */ + static readonly FLEX_GROW_ONE = 1; + static readonly LAYOUT_WEIGHT_ONE = 1; + static readonly FLEX_SHRINK_ZERO = 0; + static readonly FLEX_SHRINK_ONE = 1; + /** + * HomeTab. + */ + static readonly HOME_TAB_HEIGHT_SM: string = '56vp'; + static readonly HOME_TAB_HEIGHT_MD: string = '56vp'; + static readonly HOME_TAB_HEIGHT_LG: string = '100%'; + static readonly HOME_TAB_WIDTH_SM: string = '100%'; + static readonly HOME_TAB_WIDTH_MD: string = '100%'; + static readonly HOME_TAB_WIDTH_LG: string = '96vp'; + static readonly CONTACTS_PHONE_WIDTH_SM: string = '27%'; + static readonly CONTACTS_PHONE_WIDTH_MD: string = '28%'; + static readonly CONTACTS_PHONE_WIDTH_LG: string = '25%'; + static readonly CONTACTS_DETAIL_HEIGHT_SM: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_MD: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_LG: string = '90%'; + static readonly CONTACTS_ITEM_HEIGHT_SM: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_MD: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_LG: string = '10%'; + /** + * Document tab. + */ + static readonly DOCUMENT_TITLE_HEIGHT_SM: string = '33%'; + static readonly DOCUMENT_TITLE_HEIGHT_MD: string = '58%'; + static readonly DOCUMENT_TITLE_HEIGHT_LG: string = '100%'; + static readonly DOCUMENT_TITLE_SPACE_SM: number = 32; + static readonly DOCUMENT_TITLE_SPACE_MD: number = 56; + static readonly DOCUMENT_TITLE_SPACE_LG: number = 103; + /** + * Component opacity value: 1. + */ + static readonly FULL_OPACITY: number = 1; + /** + * Component opacity value: 0.6. + */ + static readonly SIXTY_OPACITY: number = 0.6; + /** + * Device grid column list. + */ + static readonly DEVICE_GRID_COLUMNS: string[] = ['1fr 1fr', '1fr 1fr 1fr', '1fr 1fr 1fr 1fr', '1fr 1fr 1fr 1fr 1fr', + '1fr 1fr 1fr 1fr 1fr 1fr 1fr']; + /** + * Default icon size. + */ + static readonly DEFAULT_ICON_SIZE: number = 24; + /** + * Device PC/2in1. + */ + static readonly DEVICE_2IN1: string = '2in1'; +} + +/** + * Current feature home, applet or document. + */ +export enum CurrentFeature { + HOME = 0, + APPLET = 1, + DOCUMENT = 2 +} + +/** + * Current page home,conversation or socialCircle. + */ +export enum CurrentPage { + HOME = 0, + CONVERSATION = 1, + SOCIAL_CIRCLE = 2, + ME = 3 +} + +export enum DeviceTypes { + PHONE = 'phone', + TABLET = 'tablet', + "2IN1" = '2in1', +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/ets/constants/BreakpointConstants.ets b/MultiPictureBeautification/commons/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..6fb9f097882630e1ebe0fa1e9ce4d5ad8b751c27 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [12, 15, 4]; + + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [12, 6, 7, 5, 3, 4, 2]; + + /** + * Middle device width. + */ + static readonly MIDDLE_DEVICE_WIDTH: number = 600; + + /** + * Large device width. + */ + static readonly LARGE_DEVICE_WIDTH: number = 840; + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_SCOPE: number[] = [0, 320, 600, 840]; +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/ets/utils/BreakpointType.ets b/MultiPictureBeautification/commons/base/src/main/ets/utils/BreakpointType.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee5e17d15242b712cb3685e860c8cfcf61f679be --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/ets/utils/BreakpointType.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '../constants/BreakpointConstants'; + +export class BreakpointType { + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + GetValue(currentBreakpoint: string): T { + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } else if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/module.json5 b/MultiPictureBeautification/commons/base/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5b88767e30950571337935f398f2dcbf4d1b822d --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "base", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/element/color.json b/MultiPictureBeautification/commons/base/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/element/float.json b/MultiPictureBeautification/commons/base/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..38643e439a3a7de1c6bbdd2ab61cacdad93fb129 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/resources/base/element/float.json @@ -0,0 +1,120 @@ +{ + "float": [ + { + "name": "micro_font_size", + "value": "10fp" + }, + { + "name": "smaller_mini_font_size", + "value": "11fp" + }, + { + "name": "icon_height_one", + "value": "24vp" + }, + { + "name": "icon_width_one", + "value": "24vp" + }, + { + "name": "icon_margin_one", + "value": "12vp" + }, + { + "name": "icon_margin_two", + "value": "24vp" + }, + { + "name": "main_image_size", + "value": "22vp" + }, + { + "name": "main_image_size_lg", + "value": "24vp" + }, + { + "name": "avatar_image_size", + "value": "40vp" + }, + { + "name": "bar_width", + "value": "96vp" + }, + { + "name": "text_line_height_one", + "value": "19vp" + }, + { + "name": "text_line_height_three", + "value": "14vp" + }, + { + "name": "text_line_height_two", + "value": "22vp" + }, + { + "name": "text_line_height_five", + "value": "21vp" + }, + { + "name": "background_color_grey", + "value": "#111111" + }, + { + "name": "input_raduis_one", + "value": "20vp" + }, + { + "name": "font_family_normal", + "value": "HarmonyHeiTi" + }, + { + "name": "font_family_medium", + "value": "HarmonyHeiTi-Medium" + }, + { + "name": "font_family_bold", + "value": "HarmonyHeiTi-Bold" + }, + { + "name": "font_family_semi_bold", + "value": "HarmonyHeiTi-SemiBold" + }, + { + "name": "font_size_ten", + "value": "10fp" + }, + { + "name": "font_size_eleven", + "value": "11fp" + }, + { + "name": "font_size_twelve", + "value": "12fp" + }, + { + "name": "font_size_fourteen", + "value": "14fp" + }, + { + "name": "font_size_sixteen", + "value": "16fp" + }, + { + "name": "font_size_eighteen", + "value": "18fp" + }, + { + "name": "font_size_twenty", + "value": "20fp" + }, + { + "name": "font_size_twenty_four", + "value": "24fp" + }, + { + "name": "font_size_thirty_two", + "value": "32fp" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/element/string.json b/MultiPictureBeautification/commons/base/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back.svg b/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..8135b60df3db143f028f0b3de26061b0aa17d99a --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back_black.svg b/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back_black.svg new file mode 100644 index 0000000000000000000000000000000000000000..66e3df10acde5c58b785774850139d12b0f4ad04 --- /dev/null +++ b/MultiPictureBeautification/commons/base/src/main/resources/base/media/ic_public_back_black.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/commons/base/src/main/resources/base/media/setting.jpeg b/MultiPictureBeautification/commons/base/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiPictureBeautification/commons/base/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiPictureBeautification/features/albumView/BuildProfile.ets b/MultiPictureBeautification/features/albumView/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/Index.ets b/MultiPictureBeautification/features/albumView/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddf5ef1395bdc8d31ba30d6118834b6bb3168108 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/Index.ets @@ -0,0 +1 @@ +export { AlbumView } from './src/main/ets/views/AlbumView'; \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/build-profile.json5 b/MultiPictureBeautification/features/albumView/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiPictureBeautification/features/albumView/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/hvigorfile.ts b/MultiPictureBeautification/features/albumView/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiPictureBeautification/features/albumView/obfuscation-rules.txt b/MultiPictureBeautification/features/albumView/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiPictureBeautification/features/albumView/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/oh-package.json5 b/MultiPictureBeautification/features/albumView/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d59bec4fa9e4dba8a0e7be680e94f3505d6d21b8 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "main": "Index.ets", + "author": "", + "name": "albumview", + "description": "Please describe the basic information.", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/MultiPictureBeautification/features/albumView/src/main/ets/constants/AlbumViewConstants.ets b/MultiPictureBeautification/features/albumView/src/main/ets/constants/AlbumViewConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8b559f9d5dd5ec78860f0894c6fe9a3f72cb7a0 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/ets/constants/AlbumViewConstants.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * Constants. + */ +export interface ImageData { + src: Resource, + selected: boolean +} + +export class AlbumViewConstants { + /** + * Image list. + */ + static readonly IMAGE_LIST: ImageData[] = [ + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false }, + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false }, + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false }, + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false }, + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false }, + { src: $r("app.media.album_photo1"), selected: false }, + { src: $r("app.media.album_photo2"), selected: false }, + { src: $r("app.media.album_photo3"), selected: false }, + { src: $r("app.media.album_photo4"), selected: false }, + { src: $r("app.media.album_photo5"), selected: false }, + { src: $r("app.media.album_photo6"), selected: false }, + { src: $r("app.media.album_photo7"), selected: false } + ]; + /** + * Default text. + */ + static DES_TEXT = '图片'; + /** + * Side constants. + */ + static SideConstants: string[] = [' 照片、人物、地点...', '相册', '图片', '我的收藏', '12', '视频', '新建相册1', '新建相册1', '人像', '地点', '上海市', '北京市', '南京市', '分类']; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/ets/views/AlbumView.ets b/MultiPictureBeautification/features/albumView/src/main/ets/views/AlbumView.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f8a50e0e142e17ae45d22630c44927839f2a2a0 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/ets/views/AlbumView.ets @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { SideColumn } from './SideColumn'; +import { AlbumViewConstants, ImageData } from '../constants/AlbumViewConstants' +import { BaseConstants, BreakpointConstants } from '@ohos/commons/'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +// Grid unit. +const DEFAULT_GRID_TEMPLATE: string = '1fr'; +// Animate Item. +const ANIMATE_TIME: number = 100; +// Max grid column. +const MAX_GRID_COLUMN = 16; +// Min grid column. +const MIN_GRID_COLUMN = 2; +// Finger number. +const FINGER_NUMBER = 2; +// Delay time +const DELAY = 70 +// Final delay time +const FINAL_DELAY = 100 + +@Component +export struct AlbumView { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_SM; + // Grid column num. + @State gridColumn: number = 3; + // Grid row num. + @State gridRow: number = 2; + @Consume('pageInfos') pageInfos: NavPathStack; + // Save up setTimeOut + timeOutUpDemo: number = 0 + // Save down setTimeOut + timeOutDownDemo: number = 0 + + // Change the number of Grid columns based on the width of the Grid component. + // [Start get_grid_column] + getGridColumn(value: Length): number { + return Math.floor(2 * ((parseInt(JSON.stringify(value)) / 360) - 1) + 4); + } + // [End get_grid_column] + + // PinchGesture up + up() { + if (!this.timeOutUpDemo) { + this.timeOutUpDemo = setTimeout(() => { + animateTo({ + duration: ANIMATE_TIME + }, () => { + if (this.gridColumn > MIN_GRID_COLUMN) { + this.gridColumn -= 1; + clearTimeout(this.timeOutUpDemo) + this.timeOutUpDemo = 0 + } + }) + }, DELAY) + } + setTimeout(() => { + this.timeOutUpDemo = 0 + }, FINAL_DELAY) + } + + // PinchGesture down + down() { + if (!this.timeOutDownDemo) { + this.timeOutDownDemo = setTimeout(() => { + animateTo({ + duration: ANIMATE_TIME + }, () => { + if (this.gridColumn < MAX_GRID_COLUMN) { + this.gridColumn += 1; + clearTimeout(this.timeOutDownDemo) + this.timeOutDownDemo = 0 + } + }) + + }, DELAY) + } + setTimeout(() => { + this.timeOutDownDemo = 0 + }, FINAL_DELAY) + + } + + @Builder + topRow() { + Column() { + Row() { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_public_back_black')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .onClick(() => { + this.pageInfos.pop(); + }) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + .margin({ right: $r('app.float.back_image_right') }) + + Text(AlbumViewConstants.DES_TEXT) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .height($r('app.float.text_image_height')) + Blank() + + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_gallery_material_select_checkbox')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + .margin({ right: $r('app.float.select_button_margin_right') }) + } + + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_public_more')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.tab_height')) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.tab_left'), + right: $r('app.float.tab_right'), + top: $r('app.float.tab_top'), + bottom: $r('app.float.tab_bottom') + }) + .visibility(Visibility.Visible) + } + } + + build() { + NavDestination() { + Flex() { + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + SideColumn() + .width($r('app.float.side_width')) + } + // [Start album_view_change] + Flex({ direction: FlexDirection.Column }) { + // [StartExclude album_view_change] + this.topRow() + Flex() { + Grid() { + ForEach(AlbumViewConstants.IMAGE_LIST, (item: ImageData) => { + GridItem() { + Image(item.src) + .objectFit(ImageFit.Cover) + .autoResize(true) + .borderColor(item.selected ? Color.Blue : Color.White) + .borderWidth(1) + }.aspectRatio(1) + }, (item: ImageData, index: number) => index + JSON.stringify(item)) + } + .columnsTemplate(new Array(this.gridColumn).fill(DEFAULT_GRID_TEMPLATE).join(' ')) + + } + // [EndExclude album_view_change] + .onAreaChange((oldValue: Area, newValue: Area) => { + this.gridColumn = this.getGridColumn(newValue.width); + }) + // [StartExclude album_view_change] + .gesture(PinchGesture({ fingers: FINGER_NUMBER }).onActionUpdate((event: GestureEvent) => { + if (event.scale > 1) { + this.up() + } else { + this.down() + } + })) + // [EndExclude album_view_change] + } + // [End album_view_change] + } + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/ets/views/SideColumn.ets b/MultiPictureBeautification/features/albumView/src/main/ets/views/SideColumn.ets new file mode 100644 index 0000000000000000000000000000000000000000..e35d9432a9ba54fd26acea1d420cae44a2001217 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/ets/views/SideColumn.ets @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants } from '@ohos/commons'; +import { AlbumViewConstants } from '../constants/AlbumViewConstants'; + +@Component +export struct SideColumn { + build() { + Flex({ direction: FlexDirection.Column }) { + Row() { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.switch')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .backgroundColor(Color.White) + .margin({ right: $r('app.float.side_button_right') }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.side_button_height')) + .padding({ + left: $r('app.float.side_button_padding_left'), + right: $r('app.float.side_button_padding_right'), + top: $r('app.float.side_button_padding_top'), + bottom: $r('app.float.side_button_padding_bottom') + }) + + Row() { + Stack({ alignContent: Alignment.Start }) { + TextInput({ placeholder: AlbumViewConstants.SideConstants[0] }) + .type(InputType.Normal) + .enableKeyboardOnFocus(false) + + Image($r('app.media.search2')) + .aspectRatio(1) + .autoResize(true) + .padding({ + left: $r('app.float.search_left'), + top: $r('app.float.search_top'), + bottom: $r('app.float.search_bottom') + }) + }.padding({ left: $r('app.float.search_left') }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.search_height')) + .padding({ + right: $r('app.float.search_stack_right'), + top: $r('app.float.search_stack_top') + }) + + Row() { + Image($r('app.media.public_ic_public_folder_photo')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ + left: $r('app.float.margin_eight'), + right: $r('app.float.margin_eight') + }) + Text(AlbumViewConstants.SideConstants[1]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Image($r('app.media.public_ic_public_folder_album')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ + left: $r('app.float.margin_eight'), + right: $r('app.float.margin_eight') + }) + Text(AlbumViewConstants.SideConstants[1]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: 90 + }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[2]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .fontColor('#0A59F7') + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[3]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[5]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[6]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[7]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Divider() + Row() { + Text(AlbumViewConstants.SideConstants[8]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[9]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: 90 + }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[10]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[11]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[12]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[13]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + } + } +} diff --git a/MultiPictureBeautification/features/albumView/src/main/module.json5 b/MultiPictureBeautification/features/albumView/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f15bfc413aa286280463d066213382a3d5757aae --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "albumView", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/element/color.json b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/element/float.json b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..019257beef17319e4350927381d7574f21f0244b --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/float.json @@ -0,0 +1,128 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "16vp" + }, + { + "name": "text_image_height", + "value": "24vp" + }, + { + "name": "select_button_margin_right", + "value": "24vp" + }, + { + "name": "tab_height", + "value": "54vp" + }, + { + "name": "tab_right", + "value": "26vp" + }, + { + "name": "tab_left", + "value": "26vp" + }, + { + "name": "tab_top", + "value": "14vp" + }, + { + "name": "tab_bottom", + "value": "14vp" + }, + { + "name": "side_width", + "value": "280vp" + }, + { + "name": "side_button_right", + "value": "16vp" + }, + { + "name": "side_button_height", + "value": "54vp" + }, + { + "name": "side_button_padding_left", + "value": "26vp" + }, + { + "name": "side_button_padding_right", + "value": "26vp" + }, + { + "name": "side_button_padding_top", + "value": "14vp" + }, + { + "name": "side_button_padding_bottom", + "value": "14vp" + }, + { + "name": "search_left", + "value": "10vp" + }, + { + "name": "search_top", + "value": "5vp" + }, + { + "name": "search_bottom", + "value": "5vp" + }, + { + "name": "search_height", + "value": "52vp" + }, + { + "name": "search_stack_right", + "value": "12vp" + }, + { + "name": "search_stack_top", + "value": "14vp" + }, + { + "name": "row_height", + "value": "48vp" + }, + { + "name": "margin_eight", + "value": "8vp" + }, + { + "name": "row_padding_left", + "value": "52vp" + }, + { + "name": "row_padding_right", + "value": "12vp" + }, + { + "name": "row_padding_top", + "value": "14vp" + }, + { + "name": "row_padding_left2", + "value": "76vp" + }, + { + "name": "image_width", + "value": "12vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/element/string.json b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo1.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cb4e7161886e7db0944ceddf0bcbd130371cb7c6 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo1.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo10.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo10.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5ed4902c874809a32adedc8f49de2381e16251a9 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo10.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo2.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7a3a7e45696d6f32f0818f0ce6e9252f77f463ee Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo2.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo3.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..926a77f6e6d96090d759f521ed352d6210c645d4 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo3.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo4.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fb763b87279c3fd1bcf7a2335c70f9b0846412cb Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo4.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo5.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a830f0ce6fa0a0791a3621ba1266c2b63e8b8723 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo5.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo6.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo6.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo7.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo7.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo8.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..92562e9297c7bb2c702145630847f1d6c8474ad3 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo8.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo9.jpg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..90d2f285aefd4e72a9fc48b1ad3e2be968454905 Binary files /dev/null and b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/album_photo9.jpg differ diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg new file mode 100644 index 0000000000000000000000000000000000000000..737679882c6f17be9de28b15ad352a6116e836f4 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg @@ -0,0 +1,11 @@ + + + ic_gallery_material_select_checkbox + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg new file mode 100644 index 0000000000000000000000000000000000000000..8c510014ec4f0703b0aa717cef46694ce8d156f1 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_down_0 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cc0f2ad4fd08ee0b7340c787910fd3723a36b7d --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_more.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..2078baf063972687f6922a7f3368879eef0a0bbd --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_more + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg new file mode 100644 index 0000000000000000000000000000000000000000..7457930a9c60477125ba426d30c8848c362374b6 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg @@ -0,0 +1,14 @@ + + + Public_ic_public_folder 3 + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg new file mode 100644 index 0000000000000000000000000000000000000000..1b3ad957778757c645f763408708d12999423468 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg @@ -0,0 +1,14 @@ + + + Public_ic_public_folder 2 + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/search2.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/search2.svg new file mode 100644 index 0000000000000000000000000000000000000000..df0027e3685ee63c10f64ecf695d0450fa9ea864 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/search2.svg @@ -0,0 +1,22 @@ + + + ic_s_ic S_search 2 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/albumView/src/main/resources/base/media/switch.svg b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/switch.svg new file mode 100644 index 0000000000000000000000000000000000000000..fd671d4bde73e03cf9e90f1fa1bb7610ef9f2c27 --- /dev/null +++ b/MultiPictureBeautification/features/albumView/src/main/resources/base/media/switch.svg @@ -0,0 +1,19 @@ + + + newicon备份 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/BuildProfile.ets b/MultiPictureBeautification/features/pictureEdit/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/Index.ets b/MultiPictureBeautification/features/pictureEdit/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1083e48e3c8f0d065fcb2cc819bdc4b60b740b1e --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/Index.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 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 { PictureEdit } from './src/main/ets/views/PictureEdit' \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/build-profile.json5 b/MultiPictureBeautification/features/pictureEdit/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/hvigorfile.ts b/MultiPictureBeautification/features/pictureEdit/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiPictureBeautification/features/pictureEdit/obfuscation-rules.txt b/MultiPictureBeautification/features/pictureEdit/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/oh-package.json5 b/MultiPictureBeautification/features/pictureEdit/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..40de601cd7471fa7761fadf0dc5816ee1f89bce3 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "pictureedit", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets b/MultiPictureBeautification/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e3ec9ab5af2e538712b4e975ac7092097228b71 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PicAndName, ToolsAndName } from '../viewmodel/AdaptiveViewModel'; + +export default class PictureEditConstants { + /** + * Picture size. + */ + static PICTURE_HEIGHT_SM = '90%'; + static PICTURE_HEIGHT_MD = '90%'; + static PICTURE_HEIGHT_LG = '90%'; + static PICTURE_WIDTH_SM = '72%'; + static PICTURE_WIDTH_MD = '72%'; + static PICTURE_WIDTH_LG = '40%'; + static PICTURE_WIDTH_MD_ROW = '82%'; + static PICTURE_WIDTH_MD_COLUMN = '36.6%'; + static PICTURE_HEIGHT = '95%'; + static PICTURE_HALF_HEIGHT = '50%'; + /** + * Flex basis. + */ + static SLIDER_FLEX_BASIS = 80; + static BAR_FLEX_BASIS = 60; + static OPTION_FLEX_BASIS = 250; + static IMAGE_BORDER_RADIUS = 8; + /** + * Edit text. + */ + static Edit_Text = '编辑'; + /** + * Tools name. + */ + static toolsAndName: ToolsAndName[] = [ + { + pic: $r("app.media.tools_2"), pic_name: "截取" + }, + { + pic: $r("app.media.tools_1"), pic_name: "裁剪" + }, + { + pic: $r("app.media.tools_3"), pic_name: "调节" + }, + { + pic: $r("app.media.tools_4"), pic_name: "滤镜" + }]; + /** + * Filter name. + */ + static filterAndName: PicAndName[] = [ + { + pic: $r("app.media.photo"), pic_name: "原片", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "经典", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "晨光", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "黄昏", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "光晕", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "童年", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "怀旧", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "老照片", color_filter: [1, 1, 0, 0, 0, + 1, 1, 0, 0, 0, + 1, 0, 1, 0, 0, + 1, 0, 0, 1, 0] + } + ]; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets b/MultiPictureBeautification/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..30cb495052622e837143a4d8c0a6879f146e4985 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointType } from '@ohos/commons'; +import PictureEditConstants from '../constants/PictureEditConstants'; + +export class Adaptive { + static PICTURE_HEIGHT = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureEditConstants.PICTURE_HEIGHT_SM, + PictureEditConstants.PICTURE_HEIGHT_MD, + PictureEditConstants.PICTURE_HEIGHT_LG, + ).GetValue(currentBreakpoint); + } + static PICTURE_WIDTH = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureEditConstants.PICTURE_WIDTH_SM, + PictureEditConstants.PICTURE_WIDTH_MD, + PictureEditConstants.PICTURE_WIDTH_LG, + ).GetValue(currentBreakpoint); + } +} +export interface ToolsAndName { + pic: Resource + pic_name: string +} + +export interface PicAndName { + pic: Resource + pic_name: string + color_filter: number[] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/ets/views/PictureEdit.ets b/MultiPictureBeautification/features/pictureEdit/src/main/ets/views/PictureEdit.ets new file mode 100644 index 0000000000000000000000000000000000000000..38d59db9f1cfd230bbb6d4c7f579ce2ea7bd49a1 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/ets/views/PictureEdit.ets @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/commons/'; +import PictureEditConstants from '../constants/PictureEditConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +interface ToolsAndName { + pic: Resource + pic_name: string +} + +interface PicAndName { + pic: Resource + pic_name: string + color_filter: number[] +} + +@Component +export struct PictureEdit { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @State outSetValueOne: number = 40; + @State windowDirection: boolean = true; + @State pictureWidth: string = BaseConstants.FULL_WIDTH; + @Consume('pageInfos') pageInfos: NavPathStack; + + isColumnLayout(bp: string, direction: Boolean): Boolean { + if (bp === BreakpointConstants.BREAKPOINT_SM) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_SM; + return true; + } + if (bp === BreakpointConstants.BREAKPOINT_LG) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_LG; + return false; + } + if (direction) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_MD_ROW; + } else { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_MD_COLUMN; + } + return !direction; + } + + @Builder + topBar() { + Row() { + Image($r('app.media.ic_public_back')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .onClick(() => { + this.pageInfos.pop(); + }) + .margin({ + left: $r('app.float.back_image_left'), + right: $r('app.float.back_image_right') + }) + + Text(PictureEditConstants.Edit_Text) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .fontColor(Color.White) + Blank() + if (this.currentBp === BreakpointConstants.BREAKPOINT_MD) { + Image(this.windowDirection ? $r('app.media.change2') : $r('app.media.change')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + .onClick(() => { + this.windowDirection = !this.windowDirection; + }) + } + Image($r('app.media.ic_add_2')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + Image($r('app.media.ic_add_3')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + + Image($r('app.media.ic_add_4')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + + } + .alignItems(VerticalAlign.Center) + .height($r('app.float.row_height')) + .width(BaseConstants.FULL_WIDTH) + .backgroundColor(Color.Black) + } + + @Builder + centerPicture() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.photo")) + .interpolation(ImageInterpolation.High) + .objectFit(ImageFit.Cover) + .autoResize(true) + .height(PictureEditConstants.PICTURE_HEIGHT) + .width(this.pictureWidth) + } + } + + @Builder + optionRegion() { + Flex({ + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Column : FlexDirection.Row + }) { + Flex() { + this.sliderBar() + } + .flexBasis(PictureEditConstants.SLIDER_FLEX_BASIS) + + this.filterWindows() + Flex({ justifyContent: FlexAlign.Center }) { + this.bottomBar() + } + .flexBasis(PictureEditConstants.BAR_FLEX_BASIS) + } + .height(this.isColumnLayout(this.currentBp, this.windowDirection) ? BaseConstants.FULL_HEIGHT : + PictureEditConstants.PICTURE_HALF_HEIGHT) + .padding($r('app.float.row_padding')) + } + + @Builder + sliderBar() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet, + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? Axis.Horizontal : Axis.Vertical, + reverse: this.isColumnLayout(this.currentBp, this.windowDirection) ? false : true + }) + .blockColor(Color.White) + .selectedColor(Color.White) + .trackColor($r('app.color.track_color')) + .showTips(true) + .onChange((value: number) => { + this.outSetValueOne = value; + }) + } + } + + @Builder + filterWindows() { + List() { + ForEach(PictureEditConstants.filterAndName, (item: PicAndName) => { + ListItem() { + Stack() { + Image(item.pic) + .height($r('app.float.image_height')) + .aspectRatio(1) + .autoResize(true) + .colorFilter(item.color_filter) + .clip(true) + .borderRadius(PictureEditConstants.IMAGE_BORDER_RADIUS) + Text(item.pic_name) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor($r('app.color.text_color')) + .margin({ left: $r('app.float.text_margin'), bottom: $r('app.float.text_margin') }) + } + .alignContent(Alignment.BottomStart) + } + },(item: PicAndName, index: number) => index + JSON.stringify(item)) + } + .listDirection(this.isColumnLayout(this.currentBp, this.windowDirection) ? Axis.Horizontal : Axis.Vertical) + } + + @Builder + bottomBar() { + Flex({ + justifyContent: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexAlign.SpaceAround : + FlexAlign.SpaceAround, + alignItems: ItemAlign.Center, + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Row : FlexDirection.Column, + }) { + + ForEach(PictureEditConstants.toolsAndName, (item: ToolsAndName) => { + Column() { + Image(item.pic) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .autoResize(true) + .aspectRatio(1) + .margin({ bottom: $r('app.float.image_margin') }) + Text(item.pic_name) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor($r('app.color.text_color')) + } + }, (item: ToolsAndName) => item.pic_name + ) + } + } + + build() { + NavDestination(){ + Flex({ direction: FlexDirection.Column }) { + this.topBar() + Flex({ + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Column : FlexDirection.Row + }) { + Flex() { + this.centerPicture() + } + .flexShrink(1) + + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + this.optionRegion() + } + .flexBasis(PictureEditConstants.OPTION_FLEX_BASIS) + .height(BaseConstants.FULL_HEIGHT) + } + } + .backgroundColor(Color.Black) + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } + .hideTitleBar(true) + + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/module.json5 b/MultiPictureBeautification/features/pictureEdit/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8240b1edc57483c843f6f8e4f695dcd4e12e0602 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "pictureEdit", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/color.json b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..24057d48794f1b00bd9a82e32ae49dca07b16ac4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "text_color", + "value": "#DBFFFFFF" + }, + { + "name": "track_color", + "value": "#1AFFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/float.json b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..6cfdc22a729aaf229a679e7249a7fbeca48b776a --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/float.json @@ -0,0 +1,48 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "16vp" + }, + { + "name": "back_image_left", + "value": "24vp" + }, + { + "name": "image_right", + "value": "26vp" + }, + { + "name": "row_height", + "value": "56vp" + }, + { + "name": "row_padding", + "value": "16vp" + }, + { + "name": "image_height", + "value": "68vp" + }, + { + "name": "text_margin", + "value": "8vp" + }, + { + "name": "image_margin", + "value": "2vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/string.json b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change.svg new file mode 100644 index 0000000000000000000000000000000000000000..ce090e2aca50ca776489d209fe2b964e581ce7ad --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change.svg @@ -0,0 +1,17 @@ + + + Public_ic_public_view_list备份 2 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change2.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change2.svg new file mode 100644 index 0000000000000000000000000000000000000000..a7a37f839031fcdf7be414397d3ea25acf45e171 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/change2.svg @@ -0,0 +1,17 @@ + + + qieHuang 2 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..ae211363873b9d63dbf3dac1f40c7d1b24c4ebda --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg @@ -0,0 +1,20 @@ + + + ic_add 2 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg new file mode 100644 index 0000000000000000000000000000000000000000..743b3a81ca3f5335a05df9d7603a8b6d9e22692d --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg @@ -0,0 +1,20 @@ + + + ic_add 3 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg new file mode 100644 index 0000000000000000000000000000000000000000..be0840af36979014443ed3184fa4664d3f3fa045 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg @@ -0,0 +1,25 @@ + + + ic_add 4 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/photo.jpg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/photo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..acab7e7af890f6589b9f29241c940f1a6ca1b483 Binary files /dev/null and b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/photo.jpg differ diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_1.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..b2d66f5d8bef452c104f6531180d8322bdcc1d66 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_1.svg @@ -0,0 +1,20 @@ + + + 蒙版 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_2.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..31e4ddd0541eb8f550f3e3b07900122f028a7b45 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_2.svg @@ -0,0 +1,16 @@ + + + 蒙版 2 + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_3.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_3.svg new file mode 100644 index 0000000000000000000000000000000000000000..cc5f134dfb89b152c39f292343f13cfbb6026148 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_3.svg @@ -0,0 +1,20 @@ + + + 蒙版 3 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_4.svg b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_4.svg new file mode 100644 index 0000000000000000000000000000000000000000..579a2f699e31bb898888f715f87eb8607ca1d2a2 --- /dev/null +++ b/MultiPictureBeautification/features/pictureEdit/src/main/resources/base/media/tools_4.svg @@ -0,0 +1,20 @@ + + + 蒙版 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/BuildProfile.ets b/MultiPictureBeautification/features/pictureView/BuildProfile.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/Index.ets b/MultiPictureBeautification/features/pictureView/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d77ac70787f5378d907dcd97b3eabc8faf2e233 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/Index.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 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 { PictureViewIndex } from './src/main/ets/pages/PictureViewIndex' \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/build-profile.json5 b/MultiPictureBeautification/features/pictureView/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/hvigorfile.ts b/MultiPictureBeautification/features/pictureView/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiPictureBeautification/features/pictureView/obfuscation-rules.txt b/MultiPictureBeautification/features/pictureView/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/oh-package.json5 b/MultiPictureBeautification/features/pictureView/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..56a9d873d8199d834fb9b36f98a0a602dfe5a6bc --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "pictureview", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/album": "file:../../features/albumView", + "@ohos/pictureEdit": "file:../../features/pictureEdit" + } +} diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/constants/PictureViewConstants.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/constants/PictureViewConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..336e96c51ef8bcedd540507bbca1ffd98624d22e --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/constants/PictureViewConstants.ets @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2024 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 interface ActionInterface { + icon: Resource + icon_name: string +} + +export default class PictureViewConstants { + /** + * Picture size. + */ + static PICTURE_HEIGHT_SM = '88%'; + static PICTURE_HEIGHT_MD = '100%'; + static PICTURE_HEIGHT_LG = '100%'; + static PICTURE_WIDTH_SM = '100%'; + static PICTURE_WIDTH_MD = '84.5%'; + static PICTURE_WIDTH_LG = '46.9%'; + static readonly ICON_LIST_WIDTH = "18%"; + /** + * Edit icon name. + */ + static readonly EDIT_ICON_NAME: string = '编辑'; + /** + * Actions. + */ + static ACTIONS: ActionInterface[] = [ + { + icon: $r('app.media.ic_public_share'), icon_name: "分享" + }, + { + icon: $r('app.media.ic_public_favor'), icon_name: "收藏" + }, + { + icon: $r("app.media.ic_gallery_public_details_4"), icon_name: "编辑" + }, + { + icon: $r("app.media.ic_gallery_public_details_5"), icon_name: "删除" + }, + { + icon: $r('app.media.ic_public_more'), icon_name: "更多" + } + ]; + /** + * Pictures. + */ + static readonly PICTURES: Resource[] = [ + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9"), + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9"), + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9"), + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9"), + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9"), + $r("app.media.album_photo1"), + $r("app.media.album_photo2"), + $r("app.media.album_photo3"), + $r("app.media.album_photo4"), + $r("app.media.album_photo5"), + $r("app.media.album_photo6"), + $r("app.media.album_photo7"), + $r("app.media.album_photo8"), + $r("app.media.album_photo9") + ]; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/pages/PictureViewIndex.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/pages/PictureViewIndex.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd38725e83a61d4408ef5824cecfdc4208691486 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/pages/PictureViewIndex.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TopBar } from '../view/TopBar'; +import { CenterPart } from '../view/CenterPart'; +import { BottomBar } from '../view/BottomBar'; +import { PreviewLists } from '../view/PreviewLists'; +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { AlbumView } from '@ohos/album'; +import { PictureEdit } from '@ohos/pictureEdit'; + +@Preview +@Component +export struct PictureViewIndex { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @Builder + PageMap(name: string) { + if (name === 'albumView') { + AlbumView() + } + if (name === 'pictureEdit') { + PictureEdit() + } + } + build() { + Navigation(this.pageInfos) { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center + }) { + TopBar() + CenterPart() + .flexGrow(1) + PreviewLists() + if (this.currentBp !== BreakpointConstants.BREAKPOINT_LG) { + BottomBar() + } + } .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } + .mode(NavigationMode.Stack) + .height(BaseConstants.FULL_HEIGHT) + .width(BaseConstants.FULL_WIDTH) + .navDestination(this.PageMap) + .hideTitleBar(true) + .hideToolBar(true) + .hideBackButton(true) + .titleMode(NavigationTitleMode.Mini) + + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/view/BottomBar.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/view/BottomBar.ets new file mode 100644 index 0000000000000000000000000000000000000000..33a66b5338a92f3a2c0ed1eb242b01944fae85e8 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/view/BottomBar.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PictureViewConstants, { ActionInterface } from '../constants/PictureViewConstants'; +import { BaseConstants } from '@ohos/commons'; + +@Preview +@Component +export struct BottomBar { + @Consume('pageInfos') pageInfos: NavPathStack + + build() { + Flex({ + justifyContent: FlexAlign.Center, + direction: FlexDirection.Row + }) { + ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { + Column() { + Image(item.icon) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + Text(item.icon_name) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .padding({ top: $r('app.float.icon_padding_top') }) + } + .onClick(() => { + if (item.icon_name === PictureViewConstants.EDIT_ICON_NAME) { + this.pageInfos.pushPath(new NavPathInfo('pictureEdit', [])); + } + }) + .width(PictureViewConstants.ICON_LIST_WIDTH) + },(item: ActionInterface, index: number) => index + JSON.stringify(item)) + } + .height($r('app.float.icon_list_height')) + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/view/CenterPart.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/view/CenterPart.ets new file mode 100644 index 0000000000000000000000000000000000000000..77e167bb6564199434083fa622b4514102802ee8 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/view/CenterPart.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '@ohos/commons'; +import { Adaptive } from '../viewmodel/AdaptiveViewModel' + +const FINGER_NUM: number = 2 + +@Component +export struct CenterPart { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @State scaleValue: number = 1; + @State pinchValue: number = 1; + + build() { + Flex({ direction: FlexDirection.Column }) { + Blank() + // [Start center_part] + Row() { + Column() { + Image($r('app.media.photo')) + .autoResize(true) + } + } + // [StartExclude center_part] + .height(Adaptive.PICTURE_HEIGHT(this.currentBp)) + .width(Adaptive.PICTURE_WIDTH(this.currentBp)) + .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 }) + // [EndExclude center_part] + .gesture(PinchGesture({ fingers: FINGER_NUM }) + .onActionUpdate((event: GestureEvent | undefined) => { + if (event) { + this.scaleValue = this.pinchValue * event.scale; + } + }) + .onActionEnd(() => { + this.pinchValue = this.scaleValue; + })) + // [End center_part] + Blank() + .height(this.currentBp === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.center_blank_height_lg') : 0) + } + .margin({ + top: $r('app.float.center_margin_top'), + bottom: $r('app.float.center_margin_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/view/PreviewLists.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/view/PreviewLists.ets new file mode 100644 index 0000000000000000000000000000000000000000..72b6387a7c604c3e9ce82ca7a9d3c1d4638779ff --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/view/PreviewLists.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '@ohos/commons'; +import PictureViewConstants from '../constants/PictureViewConstants'; + +const IMAGE_ASPECT_RATIO: number = 0.5; + +@Component +export struct PreviewLists { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + + build() { + List({ initialIndex: 1 }) { + ForEach(PictureViewConstants.PICTURES, (item: Resource) => { + ListItem() { + Image(item) + .height($r('app.float.list_image_height')) + .aspectRatio(IMAGE_ASPECT_RATIO) + .autoResize(true) + .margin({ left: $r('app.float.list_image_margin_left') }) + } + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .height($r('app.float.list_image_height')) + .padding({ + top: $r('app.float.list_margin_top'), + bottom: $r('app.float.list_margin_bottom') + }) + .listDirection(Axis.Horizontal) + .scrollSnapAlign(ScrollSnapAlign.CENTER) + .scrollBar(BarState.Off) + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/view/TopBar.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/view/TopBar.ets new file mode 100644 index 0000000000000000000000000000000000000000..69f810e3e866831703a675d3d1b17b1070a663f2 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/view/TopBar.ets @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import PictureViewConstants, { ActionInterface } from '../constants/PictureViewConstants'; + +const TITLE: string = '2020年12月24日'; +const SUBTITLE: string = '下午04:00 呼和浩特市'; + +@Preview +@Component +export struct TopBar { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @Consume('pageInfos') pageInfos: NavPathStack + + build() { + Flex({ + direction: FlexDirection.Row, + alignItems: ItemAlign.Center, + }) { + Column() { + Flex({ + justifyContent: FlexAlign.SpaceBetween, + direction: FlexDirection.Row, + alignItems: ItemAlign.Stretch + }) { + Row() { + Image($r('app.media.ic_public_back_black')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.back_image_right') }) + Column() { + Text(TITLE) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + Text(SUBTITLE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + } + .alignItems(HorizontalAlign.Start) + .padding($r('app.float.back_area_padding')) + } + + Row() { + Image($r('app.media.ic_public_picture')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .autoResize(true) + .onClick(() => { + this.pageInfos.pushPath(new NavPathInfo('albumView', [])); + }) + Image($r('app.media.ic_public_detail')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ left: $r('app.float.detail_image_left') }) + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { + Image(item.icon) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ left: $r('app.float.detail_image_left') }) + .onClick(() => { + if (item.icon_name === PictureViewConstants.EDIT_ICON_NAME) { + this.pageInfos.pushPath(new NavPathInfo('pictureEdit', [])); + } + }) + }, (item: ActionInterface, index: number) => index + JSON.stringify(item)) + } + } + } + } + } + .height($r('app.float.top_bar_height')) + .margin({ + top: $r('app.float.top_bar_top'), + bottom: $r('app.float.top_bar_bottom'), + left: $r('app.float.top_bar_left'), + right: $r('app.float.top_bar_right') + }) + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets b/MultiPictureBeautification/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..2223727e3b61704ca660e1059c79e0a677458ba6 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants as Constants, BreakpointType } from '@ohos/commons'; +import PictureViewConstants from '../constants/PictureViewConstants'; + +export class Adaptive { + static PICTURE_HEIGHT = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureViewConstants.PICTURE_HEIGHT_SM, + PictureViewConstants.PICTURE_HEIGHT_MD, + PictureViewConstants.PICTURE_HEIGHT_LG, + ).GetValue(currentBreakpoint); + }; + static PICTURE_WIDTH = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureViewConstants.PICTURE_WIDTH_SM, + PictureViewConstants.PICTURE_WIDTH_MD, + PictureViewConstants.PICTURE_WIDTH_LG, + ).GetValue(currentBreakpoint); + }; + static CircleImageOneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.IMAGE_ONE_WIDTH_SM, + Constants.IMAGE_ONE_WIDTH_MD, + Constants.IMAGE_ONE_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static HomeTabHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_HEIGHT_SM, + Constants.HOME_TAB_HEIGHT_MD, + Constants.HOME_TAB_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static HomeTabWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_WIDTH_SM, + Constants.HOME_TAB_WIDTH_MD, + Constants.HOME_TAB_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static ContactPhoneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_PHONE_WIDTH_SM, + Constants.CONTACTS_PHONE_WIDTH_MD, + Constants.CONTACTS_PHONE_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static ContactDetailHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_DETAIL_HEIGHT_SM, + Constants.CONTACTS_DETAIL_HEIGHT_MD, + Constants.CONTACTS_DETAIL_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static ContactItemHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_ITEM_HEIGHT_SM, + Constants.CONTACTS_ITEM_HEIGHT_MD, + Constants.CONTACTS_ITEM_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static DocumentTitleColumnHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_HEIGHT_SM, + Constants.DOCUMENT_TITLE_HEIGHT_MD, + Constants.DOCUMENT_TITLE_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static DocumentTitleColumnSpace = (currentBreakpoint: string): number => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_SPACE_SM, + Constants.DOCUMENT_TITLE_SPACE_MD, + Constants.DOCUMENT_TITLE_SPACE_LG + ).GetValue(currentBreakpoint); + }; +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/module.json5 b/MultiPictureBeautification/features/pictureView/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ddaa19ac7bbc8ed00a90d736e95ae69850314f00 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "pictureView", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/color.json b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/float.json b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..e2664252fc4d38e2345833c34b2215e16c329ee6 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/float.json @@ -0,0 +1,84 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "10vp" + }, + { + "name": "back_area_padding", + "value": "5vp" + }, + { + "name": "detail_image_left", + "value": "24vp" + }, + { + "name": "top_bar_height", + "value": "52vp" + }, + { + "name": "top_bar_left", + "value": "24vp" + }, + { + "name": "top_bar_bottom", + "value": "3vp" + }, + { + "name": "top_bar_top", + "value": "3vp" + }, + { + "name": "top_bar_right", + "value": "24vp" + }, + { + "name": "center_blank_height_lg", + "value": "24vp" + }, + { + "name": "center_margin_top", + "value": "4vp" + }, + { + "name": "center_margin_bottom", + "value": "1vp" + }, + { + "name": "list_image_height", + "value": "47vp" + }, + { + "name": "list_image_margin_left", + "value": "1vp" + }, + { + "name": "list_margin_top", + "value": "1vp" + }, + { + "name": "list_margin_bottom", + "value": "10vp" + }, + { + "name": "icon_padding_top", + "value": "4.5vp" + }, + { + "name": "icon_list_height", + "value": "56vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/string.json b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg new file mode 100644 index 0000000000000000000000000000000000000000..16bc74c9905117d880c95caebf35346631015576 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg @@ -0,0 +1,25 @@ + + + ic_gallery_public_details 4 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg new file mode 100644 index 0000000000000000000000000000000000000000..da88c29d383bf5a06b5c4f3ad17aebe9c9c8023e --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg @@ -0,0 +1,25 @@ + + + ic_gallery_public_details 5 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_detail.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_detail.svg new file mode 100644 index 0000000000000000000000000000000000000000..4eba7727667161e6808af141304bb582e99d8a84 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_detail.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_detail + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_favor.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_favor.svg new file mode 100644 index 0000000000000000000000000000000000000000..6ed99945bb665979fb509f76d42aa8244eec279f --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_favor.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_picture.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_picture.svg new file mode 100644 index 0000000000000000000000000000000000000000..71bbafb909302cfe8589d1aed558ca2b391b11c4 --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_picture.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_picture + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_reset.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_reset.svg new file mode 100644 index 0000000000000000000000000000000000000000..907182a58be9302ba98971d38bb91f93798f152d --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_reset.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reset + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_save.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_save.svg new file mode 100644 index 0000000000000000000000000000000000000000..6d27fbff30817b845bfaf8617ac9381c52dd13cf --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_save.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_save + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_share.svg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..593be89ad4209e315651252b2e9b5c73b94212be --- /dev/null +++ b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo10.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo10.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5ed4902c874809a32adedc8f49de2381e16251a9 Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo10.jpg differ diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo8.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..92562e9297c7bb2c702145630847f1d6c8474ad3 Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo8.jpg differ diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo9.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..90d2f285aefd4e72a9fc48b1ad3e2be968454905 Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/photo9.jpg differ diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4653f525ea10dffbbe81f8bf8ae715148f956956 Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1.jpg differ diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1_2.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..769b4d8b2b587c915798f908abb9c8fa7eb27e3b Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/picture1_2.jpg differ diff --git a/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/xiangCe.jpg b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/xiangCe.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df045cb2050a9e814543e58d933e2bcd59b2a0fa Binary files /dev/null and b/MultiPictureBeautification/features/pictureView/src/main/resources/base/media/xiangCe.jpg differ diff --git a/MultiPictureBeautification/hvigor/hvigor-config.json5 b/MultiPictureBeautification/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8549826266c00b203b183eaf1a8899df1a540547 --- /dev/null +++ b/MultiPictureBeautification/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */ + } +} diff --git a/MultiPictureBeautification/oh-package.json5 b/MultiPictureBeautification/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3e576a3626c7b5062a5f38c36fc2b8938f2d7658 --- /dev/null +++ b/MultiPictureBeautification/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + }, + "author": "", + "name": "multipicturebeautification", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/MultiPictureBeautification/product/phone/build-profile.json5 b/MultiPictureBeautification/product/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..197e83c1b9504b12a3837e0189185479662cad4b --- /dev/null +++ b/MultiPictureBeautification/product/phone/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/hvigorfile.ts b/MultiPictureBeautification/product/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiPictureBeautification/product/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiPictureBeautification/product/phone/obfuscation-rules.txt b/MultiPictureBeautification/product/phone/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/MultiPictureBeautification/product/phone/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/oh-package.json5 b/MultiPictureBeautification/product/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4655c9660c1bebbb72cc020478583c2974ca2791 --- /dev/null +++ b/MultiPictureBeautification/product/phone/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/edit": "file:../../features/pictureEdit", + "@ohos/view": "file:../../features/pictureView" + } +} diff --git a/MultiPictureBeautification/product/phone/src/main/ets/pages/Index.ets b/MultiPictureBeautification/product/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b92da3f9e7db09d42a0988253b748c8b30996e0 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import { PictureViewIndex } from '@ohos/view'; + +@Entry +@Component +struct Index { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + + build() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[0], + lg: BreakpointConstants.GRID_COLUMN_SPANS[0] + } }) { + Column() { + PictureViewIndex() + } + .width(BaseConstants.FULL_HEIGHT) + .height(BaseConstants.FULL_HEIGHT) + } + .height(BaseConstants.FULL_PERCENT) + .width(BaseConstants.FULL_PERCENT) + } + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/src/main/ets/phoneability/PhoneAbility.ets b/MultiPictureBeautification/product/phone/src/main/ets/phoneability/PhoneAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..d9df261ef8c12d6b65c9cff983fdbfad0945e402 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/ets/phoneability/PhoneAbility.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UIAbility, AbilityConstant, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { display, window } from '@kit.ArkUI'; +import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; +import { BaseConstants, BreakpointConstants } from '@ohos/commons/Index'; + +export default class PhoneAbility extends UIAbility { + private windowObj?: window.Window; + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow((err: BusinessError, data) => { + this.windowObj = data; + this.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', (windowSize: window.Size) => { + this.updateBreakpoint(windowSize.width); + }) + if (err.code) { + hilog.info(0x0000, 'testTag', '%{public}s', 'getMainWindow failed'); + return; + } + if (deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1) { + data.setWindowLayoutFullScreen(true); + } + }) + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + private updateBreakpoint(windowWidth: number) :void{ + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[2]) { + curBp = BreakpointConstants.BREAKPOINT_SM; + } else if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[3]) { + curBp = BreakpointConstants.BREAKPOINT_MD; + } else { + curBp = BreakpointConstants.BREAKPOINT_LG; + } + AppStorage.setOrCreate('currentBreakpoint', curBp); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/MultiPictureBeautification/product/phone/src/main/module.json5 b/MultiPictureBeautification/product/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..167dc649aec21cab70e50e36016ec6ecaf5e34e1 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/module.json5 @@ -0,0 +1,40 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "PhoneAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "PhoneAbility", + "srcEntry": "./ets/phoneability/PhoneAbility.ets", + "description": "$string:PhoneAbility_desc", + "icon": "$media:icon", + "label": "$string:PhoneAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 330, + "minWindowHeight": 600, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/src/main/resources/base/element/color.json b/MultiPictureBeautification/product/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/src/main/resources/base/element/string.json b/MultiPictureBeautification/product/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6a2d3eed2a1f45d1caf9ca472ccd6afc18c60eb8 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/src/main/resources/base/media/icon.png b/MultiPictureBeautification/product/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiPictureBeautification/product/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiPictureBeautification/product/phone/src/main/resources/base/media/startIcon.png b/MultiPictureBeautification/product/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/MultiPictureBeautification/product/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiPictureBeautification/product/phone/src/main/resources/base/profile/main_pages.json b/MultiPictureBeautification/product/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiPictureBeautification/product/phone/src/main/resources/en_US/element/string.json b/MultiPictureBeautification/product/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6a2d3eed2a1f45d1caf9ca472ccd6afc18c60eb8 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/product/phone/src/main/resources/zh_CN/element/string.json b/MultiPictureBeautification/product/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4af54176d8b493e8aa6b435e0701bfd9672d5c84 --- /dev/null +++ b/MultiPictureBeautification/product/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "一多图片美化" + } + ] +} \ No newline at end of file diff --git a/MultiPictureBeautification/screenshots/device/config.png b/MultiPictureBeautification/screenshots/device/config.png new file mode 100644 index 0000000000000000000000000000000000000000..cce0dfb773dcdd98a5faf8c230c5644555335f93 Binary files /dev/null and b/MultiPictureBeautification/screenshots/device/config.png differ diff --git a/MultiPictureBeautification/screenshots/device/foldable.png b/MultiPictureBeautification/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..968f143108c36f35029497071aba28b2bb520c7b Binary files /dev/null and b/MultiPictureBeautification/screenshots/device/foldable.png differ diff --git a/MultiPictureBeautification/screenshots/device/pad.png b/MultiPictureBeautification/screenshots/device/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..3fcde65797e292806476a6fb0f5f3d11fe2a423e Binary files /dev/null and b/MultiPictureBeautification/screenshots/device/pad.png differ diff --git a/MultiPictureBeautification/screenshots/device/phone.png b/MultiPictureBeautification/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..ab494f294197933264af9e17f86ecd7af0b02715 Binary files /dev/null and b/MultiPictureBeautification/screenshots/device/phone.png differ diff --git a/MultiPictureBeautification/screenshots/device/run.png b/MultiPictureBeautification/screenshots/device/run.png new file mode 100644 index 0000000000000000000000000000000000000000..7655fa7e041bb067e028029d820bd2d320e2cd83 Binary files /dev/null and b/MultiPictureBeautification/screenshots/device/run.png differ diff --git a/MultiShoppingPriceComparison/AppScope/app.json5 b/MultiShoppingPriceComparison/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0571d7be47f83cdf22068ab2369ae0674f5c2de2 --- /dev/null +++ b/MultiShoppingPriceComparison/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.multishoppingpricecomparison", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/MultiShoppingPriceComparison/AppScope/resources/base/element/string.json b/MultiShoppingPriceComparison/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fea8ab25ebdb9924d0c40758992e96d45bf9eb71 --- /dev/null +++ b/MultiShoppingPriceComparison/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiShoppingPriceComparison" + } + ] +} diff --git a/MultiShoppingPriceComparison/AppScope/resources/base/media/app_icon.png b/MultiShoppingPriceComparison/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiShoppingPriceComparison/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiShoppingPriceComparison/LICENSE b/MultiShoppingPriceComparison/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/MultiShoppingPriceComparison/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + + 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/MultiShoppingPriceComparison/README.en.md b/MultiShoppingPriceComparison/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..2162b7be562dfc7e0054407cdc6d275dbeccdc03 --- /dev/null +++ b/MultiShoppingPriceComparison/README.en.md @@ -0,0 +1,53 @@ +# Shopping Price Comparison + +### Introduction + +This codelab introduces how to implement shopping price comparison pages based on the adaptive and responsive layout, achieving one-time development for multi-device deployment. It uses the three-layer project architecture for code reuse and tailors the pages to different device sizes such as mobile phones, foldable phones, tablets, and PC/2-in-1 devices. + +The figure shows the effect on the mobile phone: + +![](screenshots/device/phone.en.png) + +The figure shows the effect on the foldable phone: + +![](screenshots/device/foldable.en.png) + +The figure shows the effect on the tablet and PC/2-in-1 device: + +![](screenshots/device/tablet.en.png) + +### Concepts + +- One-time development for multi-device deployment: It enables you to develop and release one set of project code for deployment on multiple devices as demanded. This feature enables you to efficiently develop applications that are compatible with multiple devices while providing distributed user experiences for cross-device transferring, migration, and collaboration. +- Adaptive layout: When the size of an external container changes, elements can automatically change based on the relative relationship to adapt to the external container. Relative relationships include the proportion, fixed aspect ratio, and display priority. +- Responsive layout: When the size of an external container changes, elements can automatically change based on the breakpoints, grids, or specific features (such as the screen direction and window width and height) to adapt to the external container. +- GridRow: It is a container that is used in a grid layout, together with its child component ****. +- GridCol: It is a container that must be used as a child component of the **** container. +- PiP: In scenarios such as video playback, video conferencing, and video calls, this feature is used to display video content in picture-in-picture mode (PiP). + +### Permissions + +N/A. + +### How to Use + +1. Install and open an app on a mobile phone, foldable phone, or tablet. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +2. Open the app and view the content on the home page. +3. Tap the Category button at the bottom to view the content on the category page. +4. Tap the shopping bag at the bottom to view the content on the shopping bag page. +5. Tap the product images on the category page to view the product details page. +6. Tap the Split-Screen button in the upper right corner to compare product information in split-screen mode. +7. Tap the Chat button at the bottom of the product details page to view the customer service page of the product details page. +8. Tap the Shopping Bag button at the bottom of the product details page to view the content on the shopping bag page. +9. Tap the Purchase button at the bottom of the product details page to view the payment page. +10. Tap the Livestreaming button on the product details page to view the content on the livestreaming room page. Tap the Close button in the upper right corner to watch the livestreaming in PiP mode. +11. Tap the recommended products on the livestreaming room page to view the product details page. +12. Tap the Shopping Bag button at the bottom of the livestreaming room page to view the content on the shopping bag page. +13. Tap Buy Now on the shopping bag page in the livestreaming room to view the content on the payment page related to livestreaming room. + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later. +3. DevEco Studio: DevEco Studio 5.0.0 Release or later. +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later. diff --git a/MultiShoppingPriceComparison/README.md b/MultiShoppingPriceComparison/README.md new file mode 100644 index 0000000000000000000000000000000000000000..675ef3da98682d077738d58c7c9b10ea6fe2b1db --- /dev/null +++ b/MultiShoppingPriceComparison/README.md @@ -0,0 +1,53 @@ +# 优秀实践-一多开发实例-购物比价 + +### 简介 + +本篇Codelab基于自适应布局和响应式布局,实现一次开发,多端部署的购物比价页面。通过“三层工程架构”实现代码复用,并根据手机、折叠屏、平板以及PC/2in1不同的设备尺寸实现对应页面。 + +手机运行效果图如下: + +![](screenshots/device/phone.png) + +折叠屏运行效果图如下: + +![](screenshots/device/foldable.png) + +平板、PC/2in1运行效果图如下: + +![](screenshots/device/tablet.png) + +### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 自适应布局:当外部容器大小发生变化时,元素可以根据相对关系自动变化以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。 +- 响应式布局:当外部容器大小发生变化时,元素可以根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化以适应外部容器变化的布局能力。 +- GridRow:栅格容器组件,仅可以和栅格子组件(GridCol)在栅格布局场景中使用。 +- GridCol:栅格子组件,必须作为栅格容器组件(GridRow)的子组件使用。 +- 画中画:应用在视频播放、视频会议、视频通话等场景下,可以使用画中画能力将视频内容以小窗(画中画)模式呈现。 + +### 相关权限 + +不涉及。 + +### 使用说明 + +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 打开应用,查看首页内容。 +3. 点击底部分类按钮,查看分类页内容。 +4. 点击底部购物袋,查看购物袋页内容。 +5. 点击分类页的商品图,查看商品详情页内容。 +6. 点击右上角的分屏按钮,分屏比较商品信息。 +7. 点击商品详情页底部的聊天按钮,查看商品详情咨询客服页内容。 +8. 点击商品详情页底部的购物袋按钮,查看商品详情-购物袋页内容。 +9. 点击商品详情页底部的购买按钮,查看商品详情-支付页内容。 +10. 点击商品详情页的直播中按钮,查看直播间页内容,点击右上角关闭按钮以画中画模式观看直播。 +11. 点击直播间页推荐商品,查看直播间-商品详情页内容。 +12. 点击直播间页底部购物袋按钮,查看直播间-购物袋页内容。 +13. 点击直播间-购物袋页的立即购买按钮,查看直播间-支付页内容。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 diff --git a/MultiShoppingPriceComparison/build-profile.json5 b/MultiShoppingPriceComparison/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..20eec659a0c9959def6d367a6e3684485793cd3a --- /dev/null +++ b/MultiShoppingPriceComparison/build-profile.json5 @@ -0,0 +1,71 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./products/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./commons/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "home", + "srcPath": "./features/home", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "detail", + "srcPath": "./features/detail", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/Index.ets b/MultiShoppingPriceComparison/commons/base/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b660a02d8c648c8b6be14f9e974f3cb9c89f7d8 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/Index.ets @@ -0,0 +1,9 @@ +export { BreakpointConstants } from './src/main/ets/constants/BreakpointConstants'; +export { BreakpointType } from './src/main/ets/utils/BreakpointType'; +export { default as Logger } from './src//main/ets/utils/Logger'; +export { CommonConstants } from './src/main/ets/constants/CommonConstants'; +export { ResourceUtil } from './src/main/ets/utils/ResourceUtil'; +export { WindowUtil } from './src/main/ets/utils/WindowUtil'; +export { DeviceScreen } from './src/main/ets/utils/DeviceScreen'; +export { AvPlayerUtil } from './src/main/ets/utils/AvPlayerUtil'; +export { PipWindowUtil } from './src/main/ets/utils/PipWindowUtil'; \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/build-profile.json5 b/MultiShoppingPriceComparison/commons/base/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..14d5b832c7c04a429ed7da4c443d19c2566a4f25 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/build-profile.json5 @@ -0,0 +1,8 @@ +{ + "apiType": "stageMode", + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/hvigorfile.ts b/MultiShoppingPriceComparison/commons/base/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiShoppingPriceComparison/commons/base/oh-package.json5 b/MultiShoppingPriceComparison/commons/base/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c764a93a96ab677a53c95087b3858bd0524e4e76 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/BreakpointConstants.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7a0da4ec7eafd2aba285ffed78d61d92dc2691f --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [4, 8, 12, 15, 11, 3, 6]; + + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [2, 3, 4, 8, 12, 5, 7]; + + /** + * Breakpoint ranges. + */ + static readonly BREAKPOINT_RANGES: number[] = [320, 600, 840]; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/CommonConstants.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b836e7893b63dd09a3dc65db52c16277a48614c8 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2024 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 class CommonConstants { + /** + * Full percent. + */ + static readonly FULL_PERCENT: string = '100%'; + + /** + * Font weight 500. + */ + static readonly FONT_WEIGHT_500: number = 500; + + /** + * Text opacity. + */ + static readonly TEXT_OPACITY: number[] = [1, 0.4, 0.6, 0.05]; + + /** + * Window util list. + */ + static readonly WINDOW_UTIL_LIST: string[] = ['windowUtil', 'secondWindowUtil']; + + /** + * Default window width. + */ + static readonly DEFAULT_WINDOW_WIDTH: number = 331; + + /** + * Lg sidebar width. + */ + static readonly LG_SIDEBAR_WIDTH: number = 96; + + /** + * Two. + */ + static readonly TWO: number = 2; + + /** + * Three. + */ + static readonly THREE: number = 3; + + /** + * Four. + */ + static readonly FOUR: number = 4; + + /** + * Five. + */ + static readonly FIVE: number = 5; + + /** + * Width unit. + */ + static readonly WIDTH_UNIT: string = 'vp'; + + /** + * Constant for screen dpi. + */ + static readonly SCREEN_DPI_CONSTANT: number = 160; + + /** + * Device types. + */ + static readonly DEVICE_TYPES: string[] = ['2in1', 'tablet']; + + /** + * Tab bar height for sm and md. + */ + static readonly TAB_BAR_HEIGHT: number = 56; + + /** + * Bottom rect height. + */ + static readonly BOTTOM_RECT_HEIGHT: number = 24; + + /** + * Bind sheet page type list. + */ + static readonly BIND_SHEET_PAGE_TYPES: string[] = ['ShopBag', 'PayCard', 'ProductDetail', 'detailPayCard']; + + /** + * Idle state of avPlayer. + */ + static readonly AV_PLAYER_IDLE_STATE: string = 'idle'; + + /** + * Initialized state of avPlayer. + */ + static readonly AV_PLAYER_INITIALIZED_STATE: string = 'initialized'; + + /** + * Prepared state of avPlayer. + */ + static readonly AV_PLAYER_PREPARED_STATE: string = 'prepared'; + + /** + * Playing state of avPlayer. + */ + static readonly AV_PLAYER_PLAYING_STATE: string = 'playing'; + + /** + * Pause state of avPlayer. + */ + static readonly AV_PLAYER_PAUSED_STATE: string = 'paused'; + + /** + * Completed state of avPlayer. + */ + static readonly AV_PLAYER_COMPLETED_STATE: string = 'completed'; + + /** + * Stopped state of avPlayer. + */ + static readonly AV_PLAYER_STOPPED_STATE: string = 'stopped'; + + /** + * Release state of avPlayer. + */ + static readonly AV_PLAYER_RELEASE_STATE: string = 'released'; + + /** + * Error state of avPlayer. + */ + static readonly AV_PLAYER_ERROR_STATE: string = 'error'; + + /** + * Live video name. + */ + static readonly LIVE_VIDEO_NAME: string = 'live.mp4'; + + /** + * Pip window util. + */ + static readonly PIP_WINDOW_UTIL: string = 'pipWindowUtil'; + + /** + * Av player util. + */ + static readonly AV_PLAYER_UTIL: string = 'avPlayerUtil'; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/AvPlayerUtil.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/AvPlayerUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..65f510c3e8d280da9842738098639c719ae7e06c --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/AvPlayerUtil.ets @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { media } from '@kit.MediaKit'; +import { common } from '@kit.AbilityKit'; +import { resourceManager } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import Logger from './Logger'; +import { CommonConstants } from '../constants/CommonConstants'; + +const uiContext: common.UIAbilityContext | undefined = AppStorage.get('uiContext'); + +export class AvPlayerUtil { + private avPlayer?: media.AVPlayer; + private url: resourceManager.RawFileDescriptor | null = null; + private playState: boolean = true; + private surfaceId: string = ''; + private onError: (err: BusinessError) => void = (err: BusinessError) => { + Logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + this.avPlayer.reset(); + } + private onStateChange: (state: media.AVPlayerState) => void = async (state: media.AVPlayerState) => { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + switch (state) { + case CommonConstants.AV_PLAYER_IDLE_STATE: + this.url = await uiContext!.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + Logger.info('AVPlayer state idle called.'); + break; + case CommonConstants.AV_PLAYER_INITIALIZED_STATE: + Logger.info('AVPlayer initialized called.'); + this.avPlayer.surfaceId = this.surfaceId; + this.avPlayer.prepare().then(() => { + Logger.info('AVPlayer prepare succeeded.'); + }, (err: BusinessError) => { + Logger.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + this.avPlayer.reset(); + }); + break; + case CommonConstants.AV_PLAYER_PREPARED_STATE: + this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; + Logger.info('AVPlayer state prepared called.'); + this.avPlayer.play(); + break; + case CommonConstants.AV_PLAYER_PLAYING_STATE: + Logger.info('AVPlayer state playing called.'); + this.playState = true; + break; + case CommonConstants.AV_PLAYER_PAUSED_STATE: + Logger.info('AVPlayer state paused called.'); + this.playState = false; + break; + case CommonConstants.AV_PLAYER_COMPLETED_STATE: + Logger.info('AVPlayer state completed called.'); + this.playState = false; + this.avPlayer.stop(); + break; + case CommonConstants.AV_PLAYER_STOPPED_STATE: + Logger.info('AVPlayer state stopped called.'); + break; + case CommonConstants.AV_PLAYER_RELEASE_STATE: + Logger.info('AVPlayer state released called.'); + break; + case CommonConstants.AV_PLAYER_ERROR_STATE: + Logger.error('AVPlayer state error called.'); + break; + default: + Logger.info('AVPlayer state unknown called.'); + break; + } + } + + static getAvPlayerUtil(): AvPlayerUtil | undefined { + if (!AppStorage.get(CommonConstants.AV_PLAYER_UTIL)) { + AppStorage.setOrCreate(CommonConstants.AV_PLAYER_UTIL, new AvPlayerUtil()); + } + return AppStorage.get(CommonConstants.AV_PLAYER_UTIL); + } + + async createAvPlayer(surfaceId: string): Promise { + if (this.avPlayer === undefined || this.avPlayer.state === CommonConstants.AV_PLAYER_RELEASE_STATE) { + this.avPlayer = await media.createAVPlayer(); + this.surfaceId = surfaceId; + Logger.info('Created AvPlayer successfully.'); + // Entering idle state. + this.url = await uiContext!.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + this.setAVPlayerCallback(); + } else { + Logger.info(`AvPlayer has been created`); + } + } + + setAVPlayerCallback(): void { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + this.avPlayer.on('error', this.onError); + this.setStateChange(); + } + + setStateChange(): void { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + this.avPlayer.on('stateChange', this.onStateChange) + } + + release(): void { + if (this.avPlayer !== undefined && this.avPlayer.state !== CommonConstants.AV_PLAYER_RELEASE_STATE) { + try { + this.avPlayer.off('error'); + this.avPlayer.off('stateChange'); + } catch (exception) { + Logger.error('Failed to unregister the error and state callback. Code: ' + JSON.stringify(exception)); + } + this.avPlayer.release(); + } else { + Logger.info(`AvPlayer release failed`); + } + } + + playerStateControl(): void { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + if (this.avPlayer.state === CommonConstants.AV_PLAYER_STOPPED_STATE) { + this.avPlayer.prepare(); + return; + } + if (!this.playState) { + this.avPlayer.play(); + } else { + this.avPlayer.pause(); + } + } + + play(): void { + if (this.avPlayer !== undefined && !this.playState) { + this.avPlayer.play(); + } else { + Logger.info(`AvPlayer play failed`); + } + } + + pause(): void { + if (this.avPlayer !== undefined && this.playState) { + this.avPlayer.pause(); + } else { + Logger.info(`AvPlayer pause failed`); + } + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/BreakpointType.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/BreakpointType.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7e64e42f7fcbd545e4cc122edd6a508e64feda5 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/BreakpointType.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '../constants/BreakpointConstants'; + +export class BreakpointType { + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + getValue(currentBreakpoint: string): T { + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/DeviceScreen.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/DeviceScreen.ets new file mode 100644 index 0000000000000000000000000000000000000000..b65bb53441b605f8b03c657522edd957ba8c068f --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/DeviceScreen.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { CommonConstants } from '../constants/CommonConstants'; + +export class DeviceScreen { + /** + * Get the screen height. + * + * @returns screen height. + */ + public static getDeviceHeight(): number { + let displayObject = display.getDefaultDisplaySync(); + let screenPixelHeight = displayObject.height; + let screenDensityDPI = displayObject.densityDPI; + return screenPixelHeight * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI); + } + + /** + * Get the screen width. + * + * @returns screen width. + */ + public static getDeviceWidth(): number { + let displayObject = display.getDefaultDisplaySync(); + let screenPixelWidth = displayObject.width; + let screenDensityDPI = displayObject.densityDPI; + return screenPixelWidth * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI); + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/Logger.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..71d6170454c7928cedd8759319a9d00640d926ba --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/Logger.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + /** + * constructor. + * + * @param Prefix Identifies the log tag. + * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. + */ + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('MultiShoppingPriceComparison'); \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/PipWindowUtil.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/PipWindowUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..90def497aea6c98458f10603d001ed2bc1358f48 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/PipWindowUtil.ets @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PiPWindow } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { CommonConstants } from '../constants/CommonConstants'; +import { AvPlayerUtil } from './AvPlayerUtil'; +import Logger from './Logger'; + +export class PipWindowUtil { + private isShowingPip: boolean = false; + private pipController?: PiPWindow.PiPController = undefined; + private mXComponentController: XComponentController = new XComponentController(); + private avPlayerUtil: AvPlayerUtil | undefined = AvPlayerUtil.getAvPlayerUtil(); + + static getPipWindowUtil(): PipWindowUtil | undefined { + if (!AppStorage.get(CommonConstants.PIP_WINDOW_UTIL)) { + AppStorage.setOrCreate(CommonConstants.PIP_WINDOW_UTIL, new PipWindowUtil()); + } + return AppStorage.get(CommonConstants.PIP_WINDOW_UTIL); + } + + getIsShowingPip(): boolean { + return this.isShowingPip; + } + + getPipController(): PiPWindow.PiPController | undefined { + return this.pipController; + } + + getXComponentController(): XComponentController { + return this.mXComponentController; + } + // [Start start_pip] + async startPip(navId: string, mXComponentController: XComponentController, context: Context, pageInfos: NavPathStack): + Promise { + if (canIUse('SystemCapability.Window.SessionManager')) { + if (!PiPWindow.isPiPEnabled()) { + Logger.error(`picture in picture disabled for current OS`); + return; + } + let config: PiPWindow.PiPConfiguration = { + context: context, + componentController: mXComponentController, + // Navigation ID of the current page. + navigationId: navId, + templateType: PiPWindow.PiPTemplateType.VIDEO_LIVE + }; + // Create a pip controller. + let promise: Promise = PiPWindow.create(config); + await promise.then((controller: PiPWindow.PiPController) => { + this.pipController = controller; + // Initializing the pip controller. + this.initPipController(); + // Enabling the pip function through the startPip interface. + this.pipController.startPiP().then(() => { + Logger.info(`Succeeded in starting pip.`); + if (this.avPlayerUtil === undefined) { + return; + } + this.avPlayerUtil.play(); + pageInfos.pop(); + }).catch((err: BusinessError) => { + Logger.error(`Failed to start pip. Cause: ${err.code}, message: ${err.message}`); + }); + }).catch((err: BusinessError) => { + Logger.error(`Failed to create pip controller. Cause: ${err.code}, message: ${err.message}`); + }); + } + } + // [End start_pip] + // [Start init_pip_controller] + initPipController(): void { + if (!this.pipController) { + return; + } + if (canIUse('SystemCapability.Window.SessionManager')) { + this.pipController.on('stateChange', (state: PiPWindow.PiPState, reason: string) => { + this.onStateChange(state, reason); + }); + this.pipController.on('controlPanelActionEvent', (event: PiPWindow.PiPActionEventType) => { + this.onActionEvent(event); + }); + } + } + // [End init_pip_controller] + onStateChange(state: PiPWindow.PiPState, reason: string): void { + if (canIUse('SystemCapability.Window.SessionManager')) { + let curState: string = ''; + switch (state) { + case PiPWindow.PiPState.ABOUT_TO_START: + curState = 'ABOUT_TO_START'; + break; + case PiPWindow.PiPState.STARTED: + curState = 'STARTED'; + this.isShowingPip = true; + break; + case PiPWindow.PiPState.ABOUT_TO_STOP: + curState = 'ABOUT_TO_STOP'; + break; + case PiPWindow.PiPState.STOPPED: + curState = 'STOPPED'; + this.isShowingPip = false; + break; + case PiPWindow.PiPState.ABOUT_TO_RESTORE: + curState = 'ABOUT_TO_RESTORE'; + this.isShowingPip = false; + break; + case PiPWindow.PiPState.ERROR: + curState = 'ERROR'; + this.isShowingPip = false; + break; + default: + break; + } + Logger.info(`onStateChange: ${curState}, reason: ${reason}`); + } + } + + onActionEvent(event: PiPWindow.PiPActionEventType) { + switch (event) { + case 'playbackStateChanged': + if (this.avPlayerUtil === undefined) { + return; + } + this.avPlayerUtil.playerStateControl(); + break; + default: + break; + } + } + // [Start stop_pip] + // Disable the pip function by calling stopPip. + async stopPip(): Promise { + if (canIUse('SystemCapability.Window.SessionManager')) { + if (this.pipController) { + let promise: Promise = this.pipController.stopPiP(); + promise.then(() => { + this.isShowingPip = false; + Logger.info(`Succeeded in stopping pip.`); + try { + this.pipController?.off('stateChange'); + this.pipController?.off('controlPanelActionEvent'); + } catch (exception) { + Logger.error('Failed to unregister callbacks. Code: ' + JSON.stringify(exception)); + } + }).catch((err: BusinessError) => { + Logger.error(`Failed to stop pip. Cause: ${err.code}, message: ${err.message}`); + }); + } + } + } + // [End stop_pip] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/ResourceUtil.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/ResourceUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..dcc7c464ccb27c34693d584a3fae36e8c0aed922 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/ResourceUtil.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointType } from './BreakpointType'; + +export class ResourceUtil { + /** + * Page column padding. + */ + private static pageColPadding: BreakpointType = new BreakpointType($r('app.float.page_col_padding_sm'), + $r('app.float.page_col_padding_md'), $r('app.float.page_col_padding_lg')); + + /** + * Common image size list. + */ + private static commonImgSize: Resource[] = [$r('app.float.common_image_size_1'), $r('app.float.common_image_size_2'), + $r('app.float.common_image_size_3'), $r('app.float.common_image_size_4'), $r('app.float.common_image_size_5'), + $r('app.float.common_image_size_6'), $r('app.float.common_image_size_7'), $r('app.float.common_image_size_8'), + $r('app.float.common_image_size_9'), $r('app.float.common_image_size_10'), $r('app.float.common_image_size_11')]; + + /** + * Common background color list. + */ + private static commonBackgroundColor: Resource[] = [$r('app.color.common_background_1'), + $r('app.color.common_background_2'), $r('app.color.common_background_3')]; + + /** + * Common border color list. + */ + private static commonBorderColorList: Resource[] = [$r('app.color.common_border_color_1'), + $r('app.color.common_border_color_2'), $r('app.color.common_border_color_3'), + $r('app.color.common_border_color_4')]; + + /** + * Common divider color. + */ + private static CommonDividerColor: Resource = $r('app.color.common_divider_color'); + + /** + * Common border radius list. + */ + private static CommonBorderRadius: Resource[] = [$r('app.float.common_border_radius_1'), + $r('app.float.common_border_radius_2'), $r('app.float.common_border_radius_3'), + $r('app.float.common_border_radius_4'), $r('app.float.common_border_radius_5'), + $r('app.float.common_border_radius_6'), $r('app.float.common_border_radius_7'), + $r('app.float.common_border_radius_8'), $r('app.float.common_border_radius_9'), + $r('app.float.common_border_radius_10')]; + + /** + * Arrow right icon. + */ + private static arrowRight: Resource = $r('app.media.arrow_right'); + + static getPageColPadding(): BreakpointType { + return ResourceUtil.pageColPadding; + } + + static getCommonImgSize(): Resource[] { + return ResourceUtil.commonImgSize; + } + + static getCommonBackgroundColor(): Resource[] { + return ResourceUtil.commonBackgroundColor; + } + + static getCommonBorderColor(): Resource[] { + return ResourceUtil.commonBorderColorList; + } + + static getCommonDividerColor(): Resource { + return ResourceUtil.CommonDividerColor; + } + + static getCommonBorderRadius(): Resource[] { + return ResourceUtil.CommonBorderRadius; + } + + static getArrowRight(): Resource { + return ResourceUtil.arrowRight; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/WindowUtil.ets b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/WindowUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa433d1ec30f1e54c710b03446d256cbdd60e001 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/ets/utils/WindowUtil.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display, window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { BreakpointConstants } from '../constants/BreakpointConstants'; +import { CommonConstants } from '../constants/CommonConstants'; +import Logger from './Logger'; + +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + +export class WindowUtil { + private windowStage?: window.WindowStage; + private mainWindowClass?: window.Window; + + static getInstance(): WindowUtil | undefined { + if (!AppStorage.get(CommonConstants.WINDOW_UTIL_LIST[0])) { + AppStorage.setOrCreate(CommonConstants.WINDOW_UTIL_LIST[0], new WindowUtil()); + } + return AppStorage.get(CommonConstants.WINDOW_UTIL_LIST[0]); + } + + static getSecondInstance(): WindowUtil | undefined { + if (!AppStorage.get(CommonConstants.WINDOW_UTIL_LIST[1])) { + AppStorage.setOrCreate(CommonConstants.WINDOW_UTIL_LIST[1], new WindowUtil()); + } + return AppStorage.get(CommonConstants.WINDOW_UTIL_LIST[1]); + } + + setWindowStage(windowStage: window.WindowStage): void { + this.windowStage = windowStage; + } + + async setMainWindow(): Promise { + if (this.windowStage === undefined) { + Logger.error(`WindowStage is undefined`); + return; + } + // Obtain the main window of the application. + await this.windowStage.getMainWindow().then((windowClass: window.Window) => { + this.mainWindowClass = windowClass; + }).catch((err: BusinessError) => { + Logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); + }); + } + + getMainWindow(): window.Window | undefined { + return this.mainWindowClass; + } + + setFullScreen(): void { + if (this.mainWindowClass === undefined) { + Logger.error(`MainWindowClass is undefined`); + return; + } + // Set full-screen display. + this.mainWindowClass.setWindowLayoutFullScreen(true).then(() => { + Logger.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((error: BusinessError) => { + Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(error)); + }); + } + + setAvoidRectHeight(): void { + if (this.mainWindowClass === undefined) { + Logger.error(`MainWindowClass is undefined`); + return; + } + let topHeight: number = this.mainWindowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height; + AppStorage.setOrCreate('topRectHeight', uiContext?.px2vp(topHeight)); + } + + updateBreakpoint(windowWidth: number): void { + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < BreakpointConstants.BREAKPOINT_RANGES[1]) { + curBp = BreakpointConstants.BREAKPOINT_SM; + } else if (windowWidthVp < BreakpointConstants.BREAKPOINT_RANGES[2]) { + curBp = BreakpointConstants.BREAKPOINT_MD; + } else { + curBp = BreakpointConstants.BREAKPOINT_LG; + } + AppStorage.setOrCreate('currentBreakpoint', curBp); + } + + updateWindowStatusType(windowStatusType: window.WindowStatusType): void { + if (canIUse('SystemCapability.Window.SessionManager')) { + let isSplitMode: boolean = false; + if (windowStatusType === window.WindowStatusType.SPLIT_SCREEN) { + isSplitMode = true; + } + AppStorage.setOrCreate('isSplitMode', isSplitMode); + } + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/module.json5 b/MultiShoppingPriceComparison/commons/base/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..292befa72c1dddac76f95da69a67dc9274bd559f --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "base", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "2in1", + "tablet" + ] + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/color.json b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1534a96af448d5ca7bce98c525a7ec670645034a --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/color.json @@ -0,0 +1,36 @@ +{ + "color": [ + { + "name": "common_background_1", + "value": "#F1F3F5" + }, + { + "name": "common_background_2", + "value": "#F7F7F7" + }, + { + "name": "common_background_3", + "value": "#0D000000" + }, + { + "name": "common_border_color_1", + "value": "#33000000" + }, + { + "name": "common_border_color_2", + "value": "#0D000000" + }, + { + "name": "common_border_color_3", + "value": "#66000000" + }, + { + "name": "common_border_color_4", + "value": "#1A000000" + }, + { + "name": "common_divider_color", + "value": "#0D000000" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/float.json b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f0676024294d5d95c9752e2b6aa6d5d9a241056b --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/float.json @@ -0,0 +1,100 @@ +{ + "float": [ + { + "name": "page_col_padding_sm", + "value": "16vp" + }, + { + "name": "page_col_padding_md", + "value": "24vp" + }, + { + "name": "page_col_padding_lg", + "value": "32vp" + }, + { + "name": "common_image_size_1", + "value": "24vp" + }, + { + "name": "common_image_size_2", + "value": "30vp" + }, + { + "name": "common_image_size_3", + "value": "36vp" + }, + { + "name": "common_image_size_4", + "value": "48vp" + }, + { + "name": "common_image_size_5", + "value": "60vp" + }, + { + "name": "common_image_size_6", + "value": "32vp" + }, + { + "name": "common_image_size_7", + "value": "12vp" + }, + { + "name": "common_image_size_8", + "value": "72vp" + }, + { + "name": "common_image_size_9", + "value": "10vp" + }, + { + "name": "common_image_size_10", + "value": "12vp" + }, + { + "name": "common_image_size_11", + "value": "40vp" + }, + { + "name": "common_border_radius_1", + "value": "2vp" + }, + { + "name": "common_border_radius_2", + "value": "4vp" + }, + { + "name": "common_border_radius_3", + "value": "5vp" + }, + { + "name": "common_border_radius_4", + "value": "8vp" + }, + { + "name": "common_border_radius_5", + "value": "12vp" + }, + { + "name": "common_border_radius_6", + "value": "14vp" + }, + { + "name": "common_border_radius_7", + "value": "16vp" + }, + { + "name": "common_border_radius_8", + "value": "20vp" + }, + { + "name": "common_border_radius_9", + "value": "24vp" + }, + { + "name": "common_border_radius_10", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/string.json b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/commons/base/src/main/resources/base/media/arrow_right.svg b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/media/arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..5283fd327effeee1bd23d4543e865a9cee4bfff6 --- /dev/null +++ b/MultiShoppingPriceComparison/commons/base/src/main/resources/base/media/arrow_right.svg @@ -0,0 +1,15 @@ + + + + Public/ic_public_arrow_right + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/Index.ets b/MultiShoppingPriceComparison/features/detail/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4ce6458be749f6b4bf400c4e86689f817019c10 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/Index.ets @@ -0,0 +1,4 @@ +export { ProductHome } from './src/main/ets/view/ProductHome'; +export { LiveHome } from './src/main/ets/view/LiveHome'; +export { ProductMoreDetail } from './src/main/ets/view/ProductMoreDetail'; +export { DetailConstants } from './src/main/ets/constants/DetailConstants'; \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/build-profile.json5 b/MultiShoppingPriceComparison/features/detail/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..14d5b832c7c04a429ed7da4c443d19c2566a4f25 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/build-profile.json5 @@ -0,0 +1,8 @@ +{ + "apiType": "stageMode", + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/hvigorfile.ts b/MultiShoppingPriceComparison/features/detail/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiShoppingPriceComparison/features/detail/oh-package.json5 b/MultiShoppingPriceComparison/features/detail/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..58b87f060f6345648a04124b3f71d955f4851fe9 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "detail", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/home": "file:../home" + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/DetailConstants.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/DetailConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5c74884ea5eb9fa7ccb06d84d81e3c1869ce479 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/DetailConstants.ets @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2024 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 class DetailConstants { + /** + * Living. + */ + static readonly LIVING = (context: Context): string => context.resourceManager.getStringSync($r('app.string.living')); + + /** + * Product detail resources. + */ + static readonly PRODUCT_DETAIL_RESOURCES: Resource[] = [$r('app.media.product_detail_1'), + $r('app.media.product_detail_2'), $r('app.media.product_detail_2'), $r('app.media.product_detail_2'), + $r('app.media.product_detail_3')]; + + /** + * Product small resources. + */ + static readonly PRODUCT_SMALL_RESOURCES: Resource[] = [$r('app.media.product_small_1'), + $r('app.media.product_small_2'), $r('app.media.product_small_2'), $r('app.media.product_small_2'), + $r('app.media.product_small_3')]; + + /** + * Gradient color list. + */ + static readonly GRADIENT_COLORS: string[] = ['#FF6354', '#CF0A2C', '#FAE8E0', '#FFC9C9']; + + /** + * Product color selection. + */ + static readonly PRODUCT_COLOR_SELECTION: Resource[] = [$r('app.media.product_small_1'), + $r('app.media.product_small_2'), $r('app.media.product_small_3')]; + + /** + * Recommended config products. + */ + static readonly RECOMMENDED_CONFIG_PRODUCTS: Resource[] = [$r('app.media.recommended_config_1'), + $r('app.media.recommended_config_2'), $r('app.media.recommended_config_3'), $r('app.media.recommended_config_4')]; + + /** + * Param string list. + */ + static readonly PARAM_STRING_LIST: string[] = ['shoppingBag', 'customerService']; + + /** + * Customer service contents. + */ + static readonly CUSTOMER_SERVICE_CONTENTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.store')), + '¥12999', '¥13999', + context.resourceManager.getStringSync($r('app.string.buy')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS1')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS2')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS3')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS4'))]; + + /** + * Product color list. + */ + static readonly COLOR_SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST3')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST4'))]; + + /** + * Product name list. + */ + static readonly CAPACITY_SELECT_NAME_LIST: string[] = ['12GB+512GB', '12GB+1T']; + + /** + * Product type list. + */ + static readonly TYPE_SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.Official_standard'))]; + + /** + * Product select type list. + */ + static readonly SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST3'))]; + + /** + * Product image list. + */ + static readonly COLOR_SELECT_IMAGE_LIST: Resource[] = [$r('app.media.pay_product_1'), + $r('app.media.pay_product_2'), $r('app.media.pay_product_3'), $r('app.media.pay_product_4')]; + + /** + * Button names. + */ + static readonly BUTTON_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.add_cart')), + context.resourceManager.getStringSync($r('app.string.buy'))]; + + /** + * Pay address and contact. + */ + static readonly PAY_INFO = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.pay_info1')), + context.resourceManager.getStringSync($r('app.string.pay_info2')), + context.resourceManager.getStringSync($r('app.string.pay_info3')), + context.resourceManager.getStringSync($r('app.string.pay_info4'))]; + + /** + * Product config list. + */ + static readonly PRODUCT_CONFIG_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES4')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES5')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES6')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES7')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES8'))]; + + /** + * User comment list. + */ + static readonly USER_COMMENT_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES1')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES2')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES3')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES4')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES5')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES6')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES7')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES8'))]; + + /** + * List space. + */ + static readonly PRODUCT_CONFIG_LIST_SPACE: number = 12; + + /** + * Y position of live row. + */ + static readonly LIVE_ROW_Y_POSITION: number = 12; + + /** + * Live stack aspect ratio. + */ + static readonly LIVE_STACK_ASPECT_RATIO: number[] = [1.2, 2.2]; + + /** + * Picture number. + */ + static readonly PICTURE_INDICATOR = (context: Context): string[] => ['/5', '3D', + context.resourceManager.getStringSync($r('app.string.compare'))]; + + /** + * Picture list space list. + */ + static readonly PICTURE_LIST_SPACES: string[] = ['8vp', '12vp', '16vp']; + + /** + * Product discount name list. + */ + static readonly PRODUCT_DISCOUNT_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES2')), + 'Mate X5:', + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES3'))]; + + /** + * Product price name list. + */ + static readonly PRODUCT_PRICE_NAMES = (context: Context): string[] => ['¥', '12999', '¥13999', + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES1')), + '07', ':', '14', ':', '50', + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES4')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES5')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES6')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES7')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES8'))]; + + /** + * 80 percent. + */ + static readonly EIGHTY_PERCENT: string = '80%'; + + /** + * Comments list. + */ + static readonly COMMENTS_LIST: number[] = [1, 2]; + + /** + * Navigation id. + */ + static readonly NAVIGATION_ID: string = 'navId'; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/LiveConstants.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/LiveConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..faa28ff623ce11e09c43c70725d4854986f57a88 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/constants/LiveConstants.ets @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024 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 class LiveConstants { + /** + * Live product image list. + */ + static readonly LIVE_PRODUCT_IMAGE_LIST: Resource[] = [$r('app.media.live_product_1'), $r('app.media.live_product_2'), + $r('app.media.live_product_3'), $r('app.media.live_product_4'), $r('app.media.live_product_5'), + $r('app.media.live_product_6'), $r('app.media.live_product_7'), $r('app.media.live_product_8')]; + /** + * Live product name list. + */ + static readonly LIVE_PRODUCT_NAME_LIST: string[] = ['HUAWEI Mate 60 Pro', 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX', + 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX']; + /** + * Live product price list. + */ + static readonly LIVE_PRODUCT_PRICE_LIST: string[] = + ['¥ 6999', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX']; + /** + * Shop car product image list. + */ + static readonly SHOP_CAR_PRODUCT_IMAGE_LIST: Resource[] = [$r('app.media.live_bag_product_1'), + $r('app.media.live_bag_product_2'), $r('app.media.live_bag_product_3'), $r('app.media.live_bag_product_4')]; + /** + * Shop car product name list. + */ + static readonly SHOP_CAR_PRODUCT_NAME_LIST: string[] = ['HUAWEI Mate 60 Pro', 'Mate Xs 2', 'MateBook E Go', + 'HUAWEI Mate 50']; + /** + * Shop car product remark list. + */ + static readonly SHOP_CAR_PRODUCT_REMARK_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST2')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST3')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1'))]; + /** + * Shop car product discounts list. + */ + static readonly SHOP_CAR_PRODUCT_DISCOUNTS_LIST = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.Gifted_points')), + context.resourceManager.getStringSync($r('app.string.flagship_machine'))], + [context.resourceManager.getStringSync($r('app.string.flagship_machine'))], + [context.resourceManager.getStringSync($r('app.string.cheaper'))], + [context.resourceManager.getStringSync($r('app.string.Gifted_points')), + context.resourceManager.getStringSync($r('app.string.flagship_machine'))]]; + /** + * Shop car product price list. + */ + static readonly SHOP_CAR_PRODUCT_PRICE_LIST: number[] = [6999, 9999, 4899, 4999]; + /** + * Shop car icon resources. + */ + static readonly SHOP_CAR_ICON_RESOURCES: Resource[] = [$r('app.media.icon_bag'), $r('app.media.icon_search'), + $r('app.media.icon_order')]; + /** + * Shop car icon names. + */ + static readonly SHOP_CAR_ICON_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.Shopping_bag')), + context.resourceManager.getStringSync($r('app.string.search')), + context.resourceManager.getStringSync($r('app.string.Order'))]; + /** + * Shop car tab list. + */ + static readonly SHOP_CAR_TABS = (context: Context): string[] => { + return [ + context.resourceManager.getStringSync($r('app.string.all')), + context.resourceManager.getStringSync($r('app.string.phone')), + context.resourceManager.getStringSync($r('app.string.mac')), + context.resourceManager.getStringSync($r('app.string.PC')), + context.resourceManager.getStringSync($r('app.string.watch')), + context.resourceManager.getStringSync($r('app.string.earphone'))] + }; + /** + * Live Comments. + */ + static readonly LIVE_COMMENTS_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST1')), + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST2')), + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST3'))]; + /** + * Comments layout weight. + */ + static readonly COMMENTS_WIDTH: string[] = ['228vp', '400vp', '290vp'] + /** + * Shopping list interval. + */ + static readonly SHOPPING_LIST_SPACE: string[] = ['12vp', '10vp']; + /** + * Currency symbol. + */ + static readonly CURRENCY_SYMBOL: string = "¥ "; + /** + * Eight. + */ + static readonly EIGHT: number = 8; + /** + * Ninety percent. + */ + static readonly NINETY_PERCENT: string = '90%'; + /** + * Pay button text. + */ + static readonly PAY_BUTTON_TEXT = + (context: Context): string => context.resourceManager.getStringSync($r('app.string.buy_now')); + /** + * X component params. + */ + static readonly X_COMPONENT_PARAMS: string[] = ['live', 'surface']; + /** + * X component aspect ratio. + */ + static readonly X_COMPONENT_ASPECT_RATIO: number = 0.56; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Comment.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Comment.ets new file mode 100644 index 0000000000000000000000000000000000000000..24aca21618e907e936bb196add4dfabd9cf53fc4 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Comment.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType } from '@ohos/commons'; +import { LiveConstants } from '../constants/LiveConstants'; + +@Component +export struct Comment { + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + ForEach(LiveConstants.LIVE_COMMENTS_LIST(this.context), (item: string, index: number) => { + Row() { + Text($r('app.string.official_review')) + .fontColor(Color.White) + .fontSize($r('app.float.live_comment_font_size')) + .linearGradient({ + angle: 0, + direction: GradientDirection.Left, + colors: [['#CF0A2C', 0], ['#FF6354', 1]] + }) + .border({ radius: $r('app.float.official_review_border_radius') }) + .padding($r('app.float.official_review_padding')) + .margin({ right: $r('app.float.official_review_margin') }) + .visibility(index === 0 ? Visibility.Visible : Visibility.None) + Text(item) + .layoutWeight(new BreakpointType(LiveConstants.COMMENTS_WIDTH[0], LiveConstants.COMMENTS_WIDTH[1], + LiveConstants.COMMENTS_WIDTH[2]).getValue(this.currentBreakpoint)) + .fontColor(Color.White) + .lineHeight($r('app.float.comments_line_height')) + .fontSize($r('app.float.live_comment_font_size')) + } + .flexGrow(0) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Top) + .margin({ bottom: $r('app.float.live_comment_margin_bottom') }) + .border({ radius: $r('app.float.live_comment_border_radius') }) + .backgroundColor($r('app.color.comment_background_color')) + .padding({ + left: $r('app.float.live_comment_padding_left'), + top: $r('app.float.live_comment_padding'), + bottom: $r('app.float.live_comment_padding'), + right: $r('app.float.live_comment_padding') + }) + }, (item: string, index: number) => item + index) + } + .flexGrow(0) + .width(new BreakpointType(LiveConstants.COMMENTS_WIDTH[0], LiveConstants.COMMENTS_WIDTH[1], + LiveConstants.COMMENTS_WIDTH[2]).getValue(this.currentBreakpoint)) + .alignItems(HorizontalAlign.Start) + .alignSelf(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? ItemAlign.End : ItemAlign.Start) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommentInput.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommentInput.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6e1e1ba2e6f3a1bee4c402aa35f68415c4f2873 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommentInput.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { LiveConstants } from '../constants/LiveConstants'; + +@Component +export struct CommentInput { + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + + @Builder + shopCarBuilder() { + }; + + @BuilderParam shopCarButton: () => void = this.shopCarBuilder; + + build() { + Row() { + TextInput({ placeholder: $r('app.string.comment_placeholder') }) + .layoutWeight(1) + .backgroundColor($r('app.color.comment_background_color')) + .placeholderColor(Color.White) + .fontSize($r('app.float.comment_font_size')) + .enableKeyboardOnFocus(false) + .margin({ + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.comment_icon_margin_right_lg') : $r('app.float.comment_icon_margin_right_sm_md') + }) + + Image($r('app.media.icon_share')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.comment_icon_margin_right_lg') : $r('app.float.comment_icon_margin_right_sm_md') + }) + + Image($r('app.media.icon_like')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.comment_icon_margin_right_lg') : $r('app.float.comment_icon_margin_right_sm_md') + }) + + this.shopCarButton() + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.comment_height')) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .margin({ + top: $r('app.float.comment_margin_top'), + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? LiveConstants.EIGHT : LiveConstants.EIGHT + + CommonConstants.BOTTOM_RECT_HEIGHT + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommonView.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommonView.ets new file mode 100644 index 0000000000000000000000000000000000000000..e392a3338080e48a1232ed8d2b9a8fcf36897ace --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CommonView.ets @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct ProductsConfigText { + public configText: string = ''; + + build() { + Text(this.configText) + .fontSize($r('app.float.products_config_font')) + .lineHeight($r('app.float.products_config_line')) + .fontWeight(FontWeight.Normal) + } +} + +@Component +export struct RightArrow { + build() { + Image(ResourceUtil.getArrowRight()) + .width($r('app.float.right_arrow_width')) + .height($r('app.float.right_arrow_height')) + } +} + +@Component +export struct ConfigTipIcon { + build() { + Image($r('app.media.ic_public_todo')) + .width($r('app.float.config_tip_icon_size')) + .height($r('app.float.config_tip_icon_size')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[2]) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .margin({ right: $r('app.float.config_tip_icon_margin') }) + } +} + +@Component +export struct ConfigTipText { + public tipText: string = ''; + + build() { + Text(this.tipText) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontSize($r('app.float.config_tip_text_font')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } +} + +@Component +export struct UtilIcon { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isShowingSidebar') isShowingSidebar: boolean = false; + @Link isMoreDetail: boolean; + public iconImg: Resource = $r('app.media.tab_home'); + + build() { + Row() { + Image(this.iconImg) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + } + .justifyContent(FlexAlign.Center) + .width(this.isShowingSidebar ? $r('app.float.util_icon_width_small') : (this.isMoreDetail ? + new BreakpointType($r('app.float.util_icon_zero'), $r('app.float.util_icon_width_small'), + $r('app.float.util_icon_width_lg')).getValue(this.currentBreakpoint) : + new BreakpointType($r('app.float.util_icon_width_sm'), $r('app.float.util_icon_width_md'), + $r('app.float.util_icon_width_lg')).getValue(this.currentBreakpoint))) + .height(CommonConstants.TAB_BAR_HEIGHT) + } +} + +@Component +export struct DetailTopIcon { + public imageResource: Resource = $r('app.media.ic_back'); + + build() { + Image(this.imageResource) + .width(ResourceUtil.getCommonImgSize()[1]) + .height(ResourceUtil.getCommonImgSize()[1]) + } +} + +@Component +export struct CommentsTitle { + private context: Context = this.getUIContext().getHostContext()! + + build() { + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[0]) + .fontSize($r('app.float.user_comments_title_font')) + .lineHeight($r('app.float.user_comments_title_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } +} + +@Component +export struct UserCommentInfo { + private context: Context = this.getUIContext().getHostContext()! + + build() { + Row() { + Image($r('app.media.user_profile')) + .width(ResourceUtil.getCommonImgSize()[2]) + .height(ResourceUtil.getCommonImgSize()[2]) + .margin({ right: $r('app.float.comments_profile_margin') }) + Column() { + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[4]) + .fontSize($r('app.float.comments_user_font')) + .lineHeight($r('app.float.comments_user_line')) + .fontWeight(FontWeight.Normal) + Rating({ rating: CommonConstants.FIVE, indicator: false }) + .stars(CommonConstants.FIVE) + .stepSize(1) + .height($r('app.float.rating_height')) + } + .justifyContent(FlexAlign.SpaceBetween) + .height(CommonConstants.FULL_PERCENT) + } + .height($r('app.float.comments_user_row_height')) + .margin({ + top: $r('app.float.comments_tag_margin'), + bottom: $r('app.float.comments_user_row_margin') + }) + } +} + +@Component +export struct CommentsContent { + private context: Context = this.getUIContext().getHostContext()! + + build() { + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[5]) + .fontSize($r('app.float.comment_text_font')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.comment_text_line')) + } +} + +@Component +export struct CommentContentExtra { + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Image($r('app.media.comment_picture')) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.comment_extra_img_size')) + .aspectRatio(1) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ + top: $r('app.float.tag_padding'), + bottom: $r('app.float.tag_padding') + }) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[7]) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontSize($r('app.float.comment_extra_font')) + .fontWeight(FontWeight.Normal) + } + .width(CommonConstants.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CustomerServiceView.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CustomerServiceView.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4040e6466745b614c98ec5bab6e7a14c7e7d3e2 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/CustomerServiceView.ets @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct CustomerServiceView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Row() { + NormalImage({ imageResource: $r('app.media.ic_public_back') }) + .margin({ right: $r('app.float.top_icon_right_margin') }) + .onClick(() => { + this.pageInfos.pop(); + }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.Visible : + Visibility.None) + NormalImage({ imageResource: $r('app.media.shop_logo') }) + .margin({ right: $r('app.float.top_icon_right_margin') }) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[0]) + .fontSize($r('app.float.customer_service_font')) + .lineHeight($r('app.float.customer_service_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + NormalImage({ imageResource: $r('app.media.ic_public_more') }) + .margin({ right: new BreakpointType($r('app.float.more_icon_margin_sm'), $r('app.float.more_icon_margin_md'), + $r('app.float.more_icon_margin_lg')).getValue(this.currentBreakpoint) }) + NormalImage({ imageResource: $r('app.media.ic_public_close') }) + .onClick(() => { + this.pageInfos.pop(); + }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.None : + Visibility.Visible) + } + .height($r('app.float.service_shop_row_height')) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .margin({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? + $r('app.float.service_shop_row_margin') : this.topRectHeight }) + + Divider() + .strokeWidth(1) + .color(ResourceUtil.getCommonDividerColor()) + + Scroll() { + Column() { + Row() { + Image($r('app.media.shop_product')) + .height(CommonConstants.FULL_PERCENT) + .aspectRatio(1) + + Column() { + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[4]) + .fontSize($r('app.float.service_card_font_3')) + .lineHeight($r('app.float.service_card_line_3')) + .fontWeight(FontWeight.Normal) + .width(CommonConstants.FULL_PERCENT) + .maxLines(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? CommonConstants.THREE : + CommonConstants.TWO) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.service_card_margin_3_lg') : $r('app.float.service_card_margin_3') }) + + Row() { + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[1]) + .fontSize($r('app.float.service_card_font_1')) + .lineHeight(CommonConstants.FULL_PERCENT) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor($r('app.color.service_font_color')) + .margin({ right: $r('app.float.service_card_margin') }) + .displayPriority(2) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[2]) + .fontSize($r('app.float.service_card_font_2')) + .lineHeight($r('app.float.service_card_line_2')) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.service_card_font')) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .decoration({ + type: TextDecorationType.LineThrough, + color: $r('app.color.service_card_font') + }) + .displayPriority(1) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + Blank() + .displayPriority(3) + Button(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[3]) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.service_button_width_lg') : $r('app.float.service_button_width')) + .height(CommonConstants.FULL_PERCENT) + .fontSize($r('app.float.service_button_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .backgroundColor($r('app.color.service_font_color')) + .displayPriority(3) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.service_card_price_height')) + } + .layoutWeight(1) + .height(CommonConstants.FULL_PERCENT) + .padding({ + top: $r('app.float.service_card_padding_top'), + bottom: $r('app.float.service_card_padding_bottom'), + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.service_card_padding_left_lg') : 0, + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.service_card_padding_right_lg') : $r('app.float.service_card_padding_right') + }) + } + .height($r('app.float.service_card_height')) + .width((CommonConstants.FULL_PERCENT)) + .borderRadius(ResourceUtil.getCommonBorderRadius()[4]) + .backgroundColor(Color.White) + + MessageView({ + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[5], + isReceiving: false, + isSameSender: false + }) + MessageView({ + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[6], + isReceiving: true, + isSameSender: false + }) + MessageView({ + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[7], + isReceiving: true, + isSameSender: true + }) + } + .width(CommonConstants.FULL_PERCENT) + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.service_padding_top_sm') : + $r('app.float.service_padding_top'), + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.service_padding_top_sm') : + $r('app.float.service_padding_top'), + left: $r('app.float.service_padding_top_sm'), + right: $r('app.float.service_padding_top_sm') + }) + } + .scrollBar(BarState.Off) + .align(Alignment.Top) + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + + Divider() + .strokeWidth(1) + .color(ResourceUtil.getCommonDividerColor()) + + Row() { + NormalImage({ imageResource: $r('app.media.ic_public_voice') }) + .margin({ right: new BreakpointType($r('app.float.service_util_right_margin_sm'), + $r('app.float.service_util_right_margin_md'), $r('app.float.service_util_right_margin_lg')) + .getValue(this.currentBreakpoint) }) + TextInput() + .height($r('app.float.text_input_height')) + .layoutWeight(1) + .margin({ right: new BreakpointType($r('app.float.service_util_right_margin_sm'), + $r('app.float.service_util_right_margin_md'), $r('app.float.service_util_right_margin_lg')) + .getValue(this.currentBreakpoint) }) + NormalImage({ imageResource: $r('app.media.ic_public_emoji') }) + .margin({ right: new BreakpointType($r('app.float.service_util_right_margin_sm'), + $r('app.float.service_util_right_margin_md'), $r('app.float.service_util_right_margin_lg')) + .getValue(this.currentBreakpoint) }) + NormalImage({ imageResource: $r('app.media.ic_public_add') }) + } + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : + CommonConstants.TAB_BAR_HEIGHT + CommonConstants.BOTTOM_RECT_HEIGHT) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : CommonConstants.BOTTOM_RECT_HEIGHT + }) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } +} + +@Component +struct NormalImage { + public imageResource: Resource = $r('app.media.ic_public_back'); + + build() { + Image(this.imageResource) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + } +} + +@Component +struct MessageView { + public messageContent: string = ''; + public isReceiving: boolean = false; + public isSameSender: boolean = false; + + build() { + Flex({ + direction: this.isReceiving ? FlexDirection.Row : FlexDirection.RowReverse, + justifyContent: FlexAlign.Start, + alignItems: ItemAlign.Start + }) { + Image(this.isReceiving ? $r('app.media.shop_logo') : $r('app.media.user_profile')) + .width(ResourceUtil.getCommonImgSize()[2]) + .height(ResourceUtil.getCommonImgSize()[2]) + .objectFit(ImageFit.Contain) + .visibility(this.isSameSender ? Visibility.None : Visibility.Visible) + .margin({ + left: !this.isReceiving ? $r('app.float.message_image_margin') : 0, + right: this.isReceiving ? $r('app.float.message_image_margin') : 0 + }) + Row() { + Text(this.messageContent) + .fontSize($r('app.float.message_content_font')) + .lineHeight($r('app.float.message_content_line')) + .fontWeight(FontWeight.Normal) + } + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .padding({ + top: $r('app.float.message_padding_top_bottom'), + bottom: $r('app.float.message_padding_top_bottom'), + left: $r('app.float.message_padding_left_right'), + right: $r('app.float.message_padding_left_right') + }) + .backgroundColor(this.isReceiving ? Color.White : $r('app.color.message_user_background')) + } + .margin({ top: this.isSameSender ? $r('app.float.message_flex_margin_same') : $r('app.float.message_flex_margin') }) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: !this.isReceiving ? $r('app.float.message_flex_padding') : (this.isSameSender ? + $r('app.float.message_flex_padding') : 0), + right: this.isReceiving ? $r('app.float.message_flex_padding') : (this.isSameSender ? + $r('app.float.message_flex_padding') : 0) + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Live.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Live.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e8875778b2ad27924e4c73e27c13dbfb7edf2a1 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/Live.ets @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { AvPlayerUtil, BreakpointConstants, BreakpointType, CommonConstants, PipWindowUtil } from '@ohos/commons'; +import { LiveConstants } from '../constants/LiveConstants'; +import { CommentInput } from './CommentInput'; +import { LiveMaskLayer } from './LiveMaskLayer'; +import { LiverHeader } from './LiverHeader'; + +@Component +export struct Live { + @StorageLink('topRectHeight') topRectHeight: number = 0; + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Link detailType: string; + @Link isMoreDetail: boolean; + @Builder shopCarBuilder() {}; + @Builder liveCloseBuilder() {}; + @BuilderParam shopCarButton: () => void = this.shopCarBuilder; + @Consume('pageInfos') pageInfos: NavPathStack; + private pipWindowUtil: PipWindowUtil | undefined = PipWindowUtil.getPipWindowUtil(); + private surfaceId: string = ''; + private avPlayerUtil: AvPlayerUtil | undefined = AvPlayerUtil.getAvPlayerUtil(); + + aboutToDisappear(): void { + if (this.avPlayerUtil === undefined) { + return; + } + this.avPlayerUtil.release(); + } + + build() { + Column() { + Stack({ alignContent: Alignment.Start }) { + Column() { + XComponent({ + id: LiveConstants.X_COMPONENT_PARAMS[0], + type: XComponentType.SURFACE, + controller: this.pipWindowUtil?.getXComponentController() + }) + .onLoad(() => { + if (this.pipWindowUtil === undefined) { + return; + } + this.surfaceId = this.pipWindowUtil.getXComponentController().getXComponentSurfaceId(); + if (this.avPlayerUtil === undefined) { + return; + } + this.avPlayerUtil.createAvPlayer(this.surfaceId); + }) + .width(new BreakpointType($r('app.float.live_video_width_sm'), $r('app.float.live_video_width_md'), + $r('app.float.live_video_width_lg')).getValue(this.currentBreakpoint)) + .aspectRatio(LiveConstants.X_COMPONENT_ASPECT_RATIO) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + .alignItems(HorizontalAlign.Center) + + Column() { + LiverHeader() + LiveMaskLayer({ + currentBreakpoint:this.currentBreakpoint, + detailType:this.detailType, + isMoreDetail:this.isMoreDetail + }) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + .onClick(() => { + if (this.avPlayerUtil === undefined) { + return; + } + this.avPlayerUtil.playerStateControl(); + }) + CommentInput({ shopCarButton:(): void => { this.shopCarButton() }}) + } + .backgroundColor(Color.Black) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveHome.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d4722bf0151f9dbaea11fbeeb06fec1d664d293 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveHome.ets @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { Callback, deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, Logger, ResourceUtil } from '@ohos/commons'; +import { Live } from './Live'; +import { ShopBag } from './ShopBag'; +import { LiveConstants } from '../constants/LiveConstants'; +import { PayCard } from './PayCard'; +import { ProductUtilView } from './ProductUtilView'; +import { ProductInfo, ProductPicture } from './ProductDetail'; + +@Component +export struct LiveHome { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @State isMoreDetail: boolean = false; + @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[0]; + @State isBindSheetOpen: boolean = false; + @State utilMoreDetail: boolean = true; + @State utilShoppingBag: boolean = false; + @State utilCustomerService: boolean = false; + @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! + private onFoldStatusChange: Callback = (data: display.FoldStatus) => { + if (canIUse('SystemCapability.Window.SessionManager')) { + if (data === display.FoldStatus.FOLD_STATUS_FOLDED && + this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[2]) { + this.isMoreDetail = false; + } + } + }; + + aboutToAppear(): void { + if (canIUse('SystemCapability.Window.SessionManager')) { + try { + display.on('foldStatusChange', this.onFoldStatusChange); + } catch (exception) { + Logger.error('Failed to register the fold status callback. Code: ' + JSON.stringify(exception)); + } + } + } + + aboutToDisappear(): void { + if (canIUse('SystemCapability.Window.SessionManager')) { + try { + display.off('foldStatusChange'); + } catch (exception) { + Logger.error('Failed to unregister the fold status callback. Code: ' + JSON.stringify(exception)); + } + } + } + + @Builder + ShopBagBuilder() { + Column() { + ShopBag({ + isMoreDetail: $isMoreDetail, + PayCardButton: (): void => { + this.PayCardButton() + } + }) + .visibility(this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[0] ? Visibility.Visible : Visibility.None) + + PayCard({ + isOpen: $isBindSheetOpen, + detailType: $detailType, + currentBreakpoint: this.currentBreakpoint + }) + .visibility(this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[1] ? Visibility.Visible : Visibility.None) + } + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? (this.detailType === + CommonConstants.BIND_SHEET_PAGE_TYPES[0] ? $r('app.float.index_col_padding_top_1') : + $r('app.float.index_col_padding_top_2')) : 0 + }) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + + @Builder + shopCarButton() { + Image($r('app.media.icon_cart')) + .width(ResourceUtil.getCommonImgSize()[10]) + .height(ResourceUtil.getCommonImgSize()[10]) + .onClick(() => { + this.isMoreDetail = true; + this.detailType = CommonConstants.BIND_SHEET_PAGE_TYPES[0]; + }) + .bindSheet((this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM && this.isMoreDetail), + this.ShopBagBuilder(), { + detents: [$r('app.float.index_bind_detents'), LiveConstants.NINETY_PERCENT], + onDisappear: () => { + this.isMoreDetail = false + }, + showClose: false, + backgroundColor: ResourceUtil.getCommonBackgroundColor()[0], + dragBar: false + }) + } + + @Builder + PayCardButton() { + Text(LiveConstants.PAY_BUTTON_TEXT(this.context)) + .width($r('app.float.pay_button_width')) + .height($r('app.float.live_pay_button_height')) + .fontColor(Color.White) + .border({ radius: ResourceUtil.getCommonBorderRadius()[5] }) + .fontSize($r('app.float.pay_button_font')) + .backgroundColor($r('app.color.pay_button_color')) + .textAlign(TextAlign.Center) + .displayPriority(3) + .onClick(() => { + this.detailType = CommonConstants.BIND_SHEET_PAGE_TYPES[1]; + }) + } + + build() { + NavDestination() { + Row() { + Column() { + Live({ + shopCarButton: (): void => { + this.shopCarButton() + }, + currentBreakpoint: this.isMoreDetail ? new BreakpointType(BreakpointConstants.BREAKPOINT_SM, + BreakpointConstants.BREAKPOINT_SM, BreakpointConstants.BREAKPOINT_MD).getValue(this.currentBreakpoint) : + this.currentBreakpoint, + detailType: $detailType, + isMoreDetail: $isMoreDetail + }) + } + .layoutWeight(5) + + Column() { + ShopBag({ + isMoreDetail: $isMoreDetail, + PayCardButton: (): void => { + this.PayCardButton() + } + }) + .visibility(this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[0] ? Visibility.Visible : + Visibility.None) + + PayCard({ + isOpen: $isBindSheetOpen, + detailType: $detailType, + currentBreakpoint: this.currentBreakpoint + }) + .visibility(this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[1] ? Visibility.Visible : + Visibility.None) + + Column() { + Scroll() { + Column() { + ProductPicture({ pageBreakpoint: BreakpointConstants.BREAKPOINT_SM, isMoreLiveDetail: $isMoreDetail }) + ProductInfo({ pageBreakpoint: BreakpointConstants.BREAKPOINT_SM }) + } + .padding({ + bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0] ? + CommonConstants.BOTTOM_RECT_HEIGHT : 0 + }) + } + .scrollBar(BarState.Off) + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_SM && this.detailType === + CommonConstants.BIND_SHEET_PAGE_TYPES[2] ? Visibility.Visible : Visibility.None) + + ProductUtilView({ + isMoreDetail: $utilMoreDetail, + isShoppingBag: $utilShoppingBag, + isCustomerService: + $utilCustomerService, + isLivePage: true + }) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + .visibility(this.isMoreDetail && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? + Visibility.Visible : Visibility.None) + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + .height(CommonConstants.FULL_PERCENT) + .layoutWeight(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 3 : 5) + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + .hideTitleBar(true) + .expandSafeArea([SafeAreaType.KEYBOARD]) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveMaskLayer.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveMaskLayer.ets new file mode 100644 index 0000000000000000000000000000000000000000..538809dc47bfc78cc84da10a02891508dd20381d --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveMaskLayer.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { Comment } from './Comment'; +import { LiveShopList } from './LiveShopList'; +import { LiveViewModel, LiveProduct } from '../viewmodel/LiveViewModel'; + +@Component +export struct LiveMaskLayer { + @StorageLink('topRectHeight') topRectHeight: number = 0; + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State currentProductIndex: number = 0; + @State liveProductList: LiveProduct[] = new LiveViewModel().getProductList().reverse(); + @Link detailType: string; + @Link isMoreDetail: boolean; + + build() { + // [Start change_flex_direction] + Flex({ + direction: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? FlexDirection.Row : + FlexDirection.Column, + justifyContent: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? FlexAlign.SpaceBetween : + FlexAlign.End + }) { + Comment({ currentBreakpoint: this.currentBreakpoint }) + LiveShopList({ + currentBreakpoint: this.currentBreakpoint, + detailType: this.detailType, + isMoreDetail: this.isMoreDetail + }) + } + // [End change_flex_direction] + .layoutWeight(1) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.live_mask_padding_right_lg') : 0, + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveShopList.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveShopList.ets new file mode 100644 index 0000000000000000000000000000000000000000..234c74044ab553d144cdd0219365344c1513807d --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiveShopList.ets @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { LiveViewModel, LiveProduct } from '../viewmodel/LiveViewModel'; +import { LiveConstants } from '../constants/LiveConstants'; + +@Component +export struct LiveShopList { + @StorageLink('currentBreakpoint') realBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State currentProductIndex: number = 0; + @Prop @Watch('getLiveProductList') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State liveProductList: LiveProduct[] = new LiveViewModel().getProductList().reverse(); + @Link detailType: string; + @Link isMoreDetail: boolean; + private scroller: Scroller = new Scroller(); + + aboutToAppear(): void { + this.getLiveProductList(); + } + + getLiveProductList(): void { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + this.liveProductList = new LiveViewModel().getProductList().reverse(); + this.currentProductIndex = this.liveProductList.length - 1; + } else { + this.liveProductList = new LiveViewModel().getProductList(); + this.currentProductIndex = 0; + } + this.scroller.scrollToIndex(this.currentProductIndex); + } + + build() { + List({ + space: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? LiveConstants.SHOPPING_LIST_SPACE[0] : + LiveConstants.SHOPPING_LIST_SPACE[1], + initialIndex: this.currentProductIndex, + scroller: this.scroller + }) { + ForEach(this.liveProductList, (item: LiveProduct, index: number) => { + ListItem() { + Row() { + Image(item.getImage()) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_list_image_size_lg') : $r('app.float.shop_list_image_size')) + .aspectRatio(1) + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + Column() { + Text(item.getName()) + .fontSize($r('app.float.shop_list_text_font_size')) + .lineHeight($r('app.float.shop_list_text_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_list_text_margin_lg') : $r('app.float.shop_list_text_margin') + }) + Text(item.getPrice()) + .fontSize($r('app.float.shop_list_text_font_size')) + .lineHeight($r('app.float.shop_list_text_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor($r('app.color.shop_price_color')) + } + .alignItems(HorizontalAlign.Start) + .visibility(index === this.currentProductIndex ? Visibility.Visible : Visibility.None) + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_text_padding_top_lg') : $r('app.float.shop_text_padding_top'), + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_text_padding_bottom_lg') : $r('app.float.shop_text_padding_bottom'), + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_text_padding_left_lg') : 0 + }) + .layoutWeight(1) + .height(CommonConstants.FULL_PERCENT) + } + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .backgroundColor(Color.White) + .width(index === this.currentProductIndex ? (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_width_index0_lg') : $r('app.float.shop_width_index0')) : + (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_width_lg') : + $r('app.float.shop_width'))) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_width_lg') : + $r('app.float.shop_width')) + .onClick(() => { + if (this.realBreakpoint !== BreakpointConstants.BREAKPOINT_SM) { + this.isMoreDetail = true; + this.detailType = CommonConstants.BIND_SHEET_PAGE_TYPES[2]; + } + }) + } + }, (item: LiveProduct, index: number) => index + JSON.stringify(item)) + } + .edgeEffect(EdgeEffect.Fade) + .alignListItem(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? ListItemAlign.End : + ListItemAlign.Start) + .scrollBar(BarState.Off) + .height(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_width') : + CommonConstants.FULL_PERCENT) + .width(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : + $r('app.float.shop_width_index0_lg')) + // [Start set_list_direction] + .listDirection(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Axis.Vertical : + Axis.Horizontal) + // [End set_list_direction] + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiverHeader.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiverHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cc426f123adcca0b36e5c95dbb713aa8cc304f1 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/LiverHeader.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, PipWindowUtil,ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct LiverHeader { + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Consume('pageInfos') pageInfos: NavPathStack; + @Builder liveCloseBuilder() {}; + @BuilderParam liveCloseButton: () => void = this.liveCloseBuilder; + private pipWindowUtil: PipWindowUtil | undefined = PipWindowUtil.getPipWindowUtil(); + + build() { + Row() { + Row() { + Image($r('app.media.live_vmall')) + .width($r('app.float.live_store_map_size')) + .aspectRatio(1) + .margin({ right: $r('app.float.live_store_map_margin') }) + Column() { + Text($r('app.string.store_name')) + .fontSize($r('app.float.store_name_font_size')) + .fontColor(Color.White) + Text($r('app.string.number_of_viewers')) + .fontSize($r('app.float.number_of_viewers_font_size')) + .fontColor(Color.White) + } + .alignItems(HorizontalAlign.Start) + .margin({ right: $r('app.float.store_margin_right') }) + } + .height($r('app.float.store_height')) + .backgroundColor($r('app.color.store_background_color')) + .border({ radius: $r('app.float.store_border_radius') }) + + Image($r('app.media.icon_close_3')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .onClick(() => { + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0]) { + if (this.pipWindowUtil === undefined) { + return; + } + this.pipWindowUtil.startPip(DetailConstants.NAVIGATION_ID, this.pipWindowUtil.getXComponentController(), + this.getUIContext().getHostContext()!, this.pageInfos); + } else { + this.pageInfos.pop(); + } + }) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.store_height')) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + }) + .margin({ top: $r('app.float.store_margin_top') }) + .justifyContent(FlexAlign.SpaceBetween) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/PayCard.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/PayCard.ets new file mode 100644 index 0000000000000000000000000000000000000000..407c5485984c50e633190eb3acf25297813e977f --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/PayCard.ets @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { PayCardViewModel, SelectProjectItem, SelectItem } from '../viewmodel/PayCardViewModel'; + +@Component +export struct PayCard { + @StorageLink('currentBreakpoint') realBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Link isOpen: boolean; + @Link detailType: string; + private context: Context = this.getUIContext().getHostContext()! + private payCardSelectList: SelectProjectItem[] = new PayCardViewModel(this.context).getPayCardSelectList(); + public dialogController?: CustomDialogController; + + build() { + Column(){ + Scroll(){ + Column() { + Row() { + Image($r('app.media.pay_main_shop')) + .height(ResourceUtil.getCommonImgSize()[4]) + .width(ResourceUtil.getCommonImgSize()[4]) + .margin({ right: $r('app.float.pay_card_product_margin') }) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[1]) + .fontColor($r('app.color.service_font_color')) + .fontSize($r('app.float.pay_card_price_font')) + Blank() + Image($r('app.media.icon_close_1')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .onClick(() => { + if (this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[3]) { + if (this.dialogController !== undefined) { + this.dialogController.close(); + } + } else { + this.detailType = CommonConstants.BIND_SHEET_PAGE_TYPES[0]; + } + }) + .alignSelf(ItemAlign.Start) + .margin({ top: $r('app.float.pay_card_icon_margin') }) + .visibility(this.realBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.None : + Visibility.Visible) + Image($r('app.media.icon_close_2')) + .width(ResourceUtil.getCommonImgSize()[5]) + .height(ResourceUtil.getCommonImgSize()[5]) + .onClick(() => { + if (this.detailType === CommonConstants.BIND_SHEET_PAGE_TYPES[3]) { + this.isOpen = false; + } else { + this.detailType = CommonConstants.BIND_SHEET_PAGE_TYPES[0]; + } + }) + .alignSelf(ItemAlign.Start) + .margin({ top: $r('app.float.pay_card_icon_margin') }) + .visibility(this.realBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? Visibility.None : + Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.pay_card_top_margin') }) + + Row() { + Image($r('app.media.icon_position')) + .height(ResourceUtil.getCommonImgSize()[5]) + .width(ResourceUtil.getCommonImgSize()[5]) + .margin({ right: $r('app.float.pay_position_margin') }) + Column() { + Text(DetailConstants.PAY_INFO(this.context)[0]) + .fontSize($r('app.float.pay_address_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .width(CommonConstants.FULL_PERCENT) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ bottom: $r('app.float.pay_address_margin') }) + Text(DetailConstants.PAY_INFO(this.context)[1]) + .fontSize($r('app.float.pay_contact_font')) + .fontColor($r('app.color.pay_contact_color')) + .width(CommonConstants.FULL_PERCENT) + .maxLines(1) + } + .layoutWeight(1) + .alignItems(HorizontalAlign.Start) + } + .margin({ bottom: $r('app.float.pay_info_margin') }) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ + top: $r('app.float.pay_info_padding_top_bottom'), + bottom: $r('app.float.pay_info_padding_top_bottom'), + left: $r('app.float.pay_info_padding_left_right'), + right: $r('app.float.pay_info_padding_left_right') + }) + + Column() { + ForEach(this.payCardSelectList, (item: SelectProjectItem, index: number) => { + Column() { + Text(item.getName()) + .fontSize($r('app.float.pay_config_title_font')) + .alignSelf(ItemAlign.Start) + .margin({ bottom: $r('app.float.pay_config_title_margin') }) + .lineHeight($r('app.float.pay_config_title_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Flex({ + wrap: FlexWrap.Wrap, + justifyContent: FlexAlign.Start + }) { + ForEach(item.getSelectItemList(), (selectItem: SelectItem, selectIndex: number) => { + Row() { + Image(selectItem.getImage()) + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .visibility(selectItem.getImage() === null ? Visibility.None : Visibility.Visible) + Text(selectItem.getName()) + .fontColor(selectIndex === 0 ? $r('app.color.service_font_color') : Color.Black) + .fontSize($r('app.float.pay_config_name_font')) + .textAlign(TextAlign.Center) + .margin({ + left: $r('app.float.pay_config_name_margin'), + right: $r('app.float.pay_config_name_margin') + }) + } + .backgroundColor(selectIndex === 0 ? $r('app.color.pay_config_background_selected') : + ResourceUtil.getCommonBackgroundColor()[2]) + .border({ + color: selectIndex === 0 ? $r('app.color.service_font_color') : + ResourceUtil.getCommonBackgroundColor()[2], + width: index === 0 ? $r('app.float.pay_config_border_width') : 0, + radius: ResourceUtil.getCommonBorderRadius()[3] + }) + .height($r('app.float.pay_config_height')) + .margin({ + right: $r('app.float.pay_config_margin'), + bottom: $r('app.float.pay_config_margin') + }) + }, (selectItem: SelectItem, selectIndex: number) => JSON.stringify(selectItem) + selectIndex) + } + .width(CommonConstants.FULL_PERCENT) + } + .margin({ top: $r('app.float.pay_config_col_margin_top') }) + .width(CommonConstants.FULL_PERCENT) + }, (item: SelectProjectItem, index: number) => JSON.stringify(item) + index) + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.pay_config_col_margin_bottom') }) + .backgroundColor(Color.White) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ + left: $r('app.float.pay_config_col_padding'), + right: $r('app.float.pay_config_col_padding') + }) + + Row() { + Image($r('app.media.icon_pay')) + .height(ResourceUtil.getCommonImgSize()[5]) + .width(ResourceUtil.getCommonImgSize()[5]) + .margin({ right: $r('app.float.pay_wallet_icon_margin') }) + Text(DetailConstants.PAY_INFO(this.context)[2]) + .fontSize($r('app.float.pay_wallet_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + Checkbox() + .selectedColor($r('app.color.util_button_2')) + .shape(CheckBoxShape.CIRCLE) + .width($r('app.float.checkbox_width')) + } + .padding({ + top: $r('app.float.wallet_row_padding_1'), + left: $r('app.float.wallet_row_padding_2'), + bottom: $r('app.float.wallet_row_padding_1'), + right: $r('app.float.wallet_row_padding_2') + }) + .margin({ bottom: $r('app.float.wallet_row_margin') }) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .backgroundColor(Color.White) + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + } + .scrollBar(BarState.Off) + .layoutWeight(1) + .align(Alignment.Top) + .width(CommonConstants.FULL_PERCENT) + + Button(DetailConstants.PAY_INFO(this.context)[3]) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor($r('app.color.util_button_2')) + .height($r('app.float.pay_button_height')) + .margin({ + top: $r('app.float.pay_button_margin_top'), + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? $r('app.float.pay_button_margin_bottom') : + CommonConstants.BOTTOM_RECT_HEIGHT + }) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductConfig.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductConfig.ets new file mode 100644 index 0000000000000000000000000000000000000000..b777656ff4068f445af680bc5a8956def055d4b7 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductConfig.ets @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { CommentContentExtra, CommentsContent, CommentsTitle, ConfigTipIcon, ConfigTipText, ProductsConfigText, + RightArrow, UserCommentInfo } from './CommonView'; + +@Component +export struct ProductConfig { + @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Column() { + Row() { + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[0] }) + .margin({ right: $r('app.float.products_config_margin_12') }) + Column() { + Row() { + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[1] }) + Blank() + RightArrow() + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.products_config_margin_8') }) + + List({ space: DetailConstants.PRODUCT_CONFIG_LIST_SPACE }) { + ForEach(DetailConstants.PRODUCT_COLOR_SELECTION, (item: Resource) => { + ListItem() { + Image(item) + .width(ResourceUtil.getCommonImgSize()[2]) + .height(ResourceUtil.getCommonImgSize()[2]) + } + }, (item: Resource, index: number) => JSON.stringify(item) + index) + } + .listDirection(Axis.Horizontal) + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.products_config_margin_8') }) + + Divider() + .width(CommonConstants.FULL_PERCENT) + .strokeWidth(1) + .color($r('app.color.divider_color')) + } + .layoutWeight(1) + } + .alignItems(VerticalAlign.Top) + .margin({ bottom: $r('app.float.products_config_margin_12') }) + + Row() { + Column() { + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[2] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[3] }) + } + .width($r('app.float.config_text_col_width')) + .height($r('app.float.config_text_col_height')) + .margin({ right: $r('app.float.products_config_margin_12') }) + + Column() { + Row() { + List({ space: DetailConstants.PRODUCT_CONFIG_LIST_SPACE }) { + ForEach(DetailConstants.RECOMMENDED_CONFIG_PRODUCTS, (item: Resource) => { + ListItem() { + Image(item) + .width(ResourceUtil.getCommonImgSize()[2]) + .height(ResourceUtil.getCommonImgSize()[2]) + } + }, (item: Resource, index: number) => JSON.stringify(item) + index) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .layoutWeight(1) + .margin({ bottom: $r('app.float.products_config_margin_8') }) + + RightArrow() + } + .width(CommonConstants.FULL_PERCENT) + + Divider() + .width(CommonConstants.FULL_PERCENT) + .strokeWidth(1) + .color($r('app.color.divider_color')) + } + .layoutWeight(1) + } + .alignItems(VerticalAlign.Top) + .margin({ bottom: $r('app.float.products_config_margin_12') }) + + Row() { + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[4] }) + .margin({ right: $r('app.float.products_config_margin_12') }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[5] }) + Blank() + RightArrow() + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.products_config_margin_12') }) + } + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: $r('app.float.products_padding_sm'), + right: $r('app.float.products_padding_sm') + }) + + Scroll() { + Row() { + ConfigTipIcon() + ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[6] }) + .margin({ right: $r('app.float.products_config_margin_12') }) + ConfigTipIcon() + ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[7] }) + .layoutWeight(1) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + .align(Alignment.Start) + .scrollBar(BarState.Off) + .scrollable(ScrollDirection.Horizontal) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor($r('app.color.config_tip_background')) + .height($r('app.float.config_tip_row_height')) + .padding({ + left: $r('app.float.products_padding_sm'), + right: $r('app.float.products_padding_sm') + }) + } + .alignItems(HorizontalAlign.Start) + .backgroundColor(Color.White) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ top: $r('app.float.products_config_margin_12') }) + .margin({ bottom: new BreakpointType($r('app.float.products_padding_sm'), $r('app.float.products_padding_md'), + $r('app.float.products_padding_lg')).getValue(this.pageBreakpoint) }) + } +} + +@Component +export struct UserComments { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isShowingSidebar') isShowingSidebar: boolean = false; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Row() { + CommentsTitle() + .layoutWeight(1) + Blank() + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[6]) + .fontSize($r('app.float.all_comments_font')) + .lineHeight($r('app.float.all_comments_line')) + .fontWeight(FontWeight.Normal) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .margin({ right: $r('app.float.all_comments_margin') }) + .onClick(() => { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + this.isShowingSidebar = true; + } + }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + RightArrow() + .displayPriority(1) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + } + .height($r('app.float.user_comments_title_line')) + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.comments_title_margin') }) + + Scroll() { + Row() { + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[1] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[2] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[3] }) + } + } + .align(Alignment.Start) + .width(CommonConstants.FULL_PERCENT) + .scrollable(ScrollDirection.Horizontal) + .scrollBar(BarState.Off) + + Column() { + UserCommentInfo() + CommentsContent() + } + .alignItems(HorizontalAlign.Start) + } + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding($r('app.float.user_comments_col_padding')) + } +} + +@Component +export struct AllComments { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Scroll() { + Column() { + CommentsTitle() + + Scroll() { + Row() { + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[1] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[2] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[3] }) + } + } + .align(Alignment.Start) + .scrollable(ScrollDirection.Horizontal) + .scrollBar(BarState.Off) + .width(CommonConstants.FULL_PERCENT) + .margin({ top: $r('app.float.comments_title_margin') }) + + Column() { + ForEach(DetailConstants.COMMENTS_LIST, (item: number) => { + UserCommentInfo() + CommentsContent() + CommentContentExtra() + if (item < CommonConstants.TWO) { + Divider() + .width(CommonConstants.FULL_PERCENT) + .strokeWidth(1) + .color($r('app.color.divider_color')) + .margin({ top: $r('app.float.comments_title_margin') }) + } + }, (item: number, index: number) => index + JSON.stringify(item)) + } + .alignItems(HorizontalAlign.Start) + } + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding($r('app.float.user_comments_col_padding')) + .margin({ bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : + CommonConstants.BOTTOM_RECT_HEIGHT }) + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .scrollBar(BarState.Off) + } +} + +@Component +struct CommentsTag { + public tagText: string = ''; + + build() { + Row() { + Text(this.tagText) + .fontSize($r('app.float.tag_font')) + .fontWeight(FontWeight.Normal) + } + .margin({ right: $r('app.float.tag_margin') }) + .padding({ + left: $r('app.float.tag_padding'), + right: $r('app.float.tag_padding') + }) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .height($r('app.float.tag_row_height')) + .backgroundColor($r('app.color.user_comments_tag_background')) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDetail.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..3134644024dac98bc83e9b3a413d233d2c87c8cd --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDetail.ets @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; +import { AbilityConstant, common, StartOptions, Want } from '@kit.AbilityKit'; +import { ClassifyConstants } from '@ohos/home'; +import { BreakpointConstants, BreakpointType, CommonConstants, Logger, PipWindowUtil, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { ProductPrice } from './ProductPrice'; +import { ProductDiscount } from './ProductDiscount'; +import { ProductConfig, UserComments } from './ProductConfig'; + +@Component +export struct ProductPicture { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @StorageLink('isSplitMode') isSplitMode: boolean = false; + @State currentSwiperIndex: number = 0; + @Prop pageBreakpoint: string; + @Link isMoreLiveDetail: boolean; + @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! + private pipWindowUtil: PipWindowUtil | undefined = PipWindowUtil.getPipWindowUtil(); + private abilityName: string = (this.context as common.UIAbilityContext).abilityInfo.name; + + @Builder + PictureIndicator(text: string) { + Text(text) + .fontSize($r('app.float.picture_indicator_font')) + .fontWeight(FontWeight.Normal) + .margin({ right: $r('app.float.picture_indicator_margin') }) + } + + build() { + Column() { + Stack({ alignContent: this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Alignment.TopEnd : + Alignment.End }) { + Swiper() { + ForEach(DetailConstants.PRODUCT_DETAIL_RESOURCES, (item: Resource) => { + Image(item) + .width(CommonConstants.FULL_PERCENT) + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .align(Alignment.Center) + .indicator(false) + .displayCount(1) + .nextMargin(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_MD ? $r('app.float.product_swiper_margin') : + 0) + .prevMargin(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_MD ? $r('app.float.product_swiper_margin') : + 0) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .onChange((index: number) => { + this.currentSwiperIndex = index; + }) + + Row() { + Image($r('app.media.ic_back')) + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .margin({ right: $r('app.float.picture_icon_margin') }) + .onClick(() => { + if (this.isMoreLiveDetail) { + this.isMoreLiveDetail = false; + } else { + this.pageInfos.pop(); + } + }) + Image($r('app.media.ic_zoom_out')) + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .visibility(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + Blank() + // [Start product_detail] + Image(this.isSplitMode ? $r('app.media.icon_split') : $r('app.media.ic_mate_pad_2')) + // [StartExclude product_detail] + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .margin({ right: this.pageBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.picture_icon_margin_sm') : $r('app.float.picture_icon_margin') }) + // [EndExclude product_detail] + .onClick(() => { + if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0]) { + return; + } + if (!this.isSplitMode) { + let want: Want = { + bundleName: 'com.huawei.multishoppingpricecomparison', + abilityName: 'SecondAbility' + }; + let option: StartOptions = { windowMode: AbilityConstant.WindowMode.WINDOW_MODE_SPLIT_PRIMARY }; + (this.context as common.UIAbilityContext).startAbility(want, option); + } else { + (this.context as common.UIAbilityContext).terminateSelf(); + } + }) + // [End product_detail] + .visibility(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_MD || this.isSplitMode ? + Visibility.Visible : Visibility.None) + Image($r('app.media.ic_more')) + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .visibility(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.None : + Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + .position({ x: 0, y: DetailConstants.LIVE_ROW_Y_POSITION }) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + + Column() { + Image($r('app.media.ic_public_living')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .borderRadius(ResourceUtil.getCommonBorderRadius()[4]) + Text(DetailConstants.LIVING(this.context)) + .fontSize($r('app.float.picture_live_font')) + .lineHeight($r('app.float.picture_live_line')) + .fontWeight(FontWeight.Normal) + } + .onClick(() => { + if (this.isMoreLiveDetail) { + return; + } + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0]) { + if (this.pipWindowUtil === undefined) { + return; + } + if (this.pipWindowUtil.getIsShowingPip()) { + this.pipWindowUtil.stopPip().then(() => { + this.pageInfos.pushPath({ name: ClassifyConstants.PAGE_INFO_LIST[0] }); + }).catch((err: BusinessError) => { + Logger.error(`Failed to stop pip. Cause: ${err.code}, message: ${err.message}`); + }); + } else { + this.pageInfos.pushPath({ name: ClassifyConstants.PAGE_INFO_LIST[0] }); + } + } else { + this.pageInfos.pushPath({ name: ClassifyConstants.PAGE_INFO_LIST[0] }); + } + }) + .margin({ + top: this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.picture_live_col_margin_lg') : + 0, + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .borderWidth(1) + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .borderColor($r('app.color.living_border_color')) + .backgroundColor($r('app.color.living_background')) + .justifyContent(FlexAlign.SpaceEvenly) + .height($r('app.float.picture_live_col_height')) + .width($r('app.float.picture_live_col_width')) + .visibility(this.abilityName === 'SecondAbility' ? Visibility.None : Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 1 : -1) + .aspectRatio(new BreakpointType(DetailConstants.LIVE_STACK_ASPECT_RATIO[0], + DetailConstants.LIVE_STACK_ASPECT_RATIO[1], -1).getValue(this.pageBreakpoint)) + + Row() { + Column() { + Text(JSON.stringify(this.currentSwiperIndex + 1) + DetailConstants.PICTURE_INDICATOR(this.context)[0]) + .fontSize($r('app.float.picture_number_font')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + } + .width($r('app.float.picture_number_row_width')) + .height($r('app.float.picture_number_row_height')) + .backgroundColor($r('app.color.swiper_indicator_background')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .justifyContent(FlexAlign.Center) + } + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.End) + .padding({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + + Row() { + this.PictureIndicator(DetailConstants.PICTURE_INDICATOR(this.context)[1]) + Image(ResourceUtil.getArrowRight()) + .width($r('app.float.picture_arrow_width')) + .height($r('app.float.picture_arrow_height')) + .margin({ right: $r('app.float.picture_arrow_margin') }) + this.PictureIndicator(DetailConstants.PICTURE_INDICATOR(this.context)[2]) + Image(ResourceUtil.getArrowRight()) + .width($r('app.float.picture_arrow_width')) + .height($r('app.float.picture_arrow_height')) + } + .padding({ + left: $r('app.float.picture_indicator_row_padding_left'), + right: $r('app.float.picture_indicator_row_padding_right') + }) + .backgroundColor($r('app.color.products_compare')) + .width($r('app.float.picture_indicator_row_width')) + .height($r('app.float.picture_indicator_row_height')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[4]) + .margin({ top: $r('app.float.picture_indicator_row_margin') }) + + Row() { + List({ space: new BreakpointType(DetailConstants.PICTURE_LIST_SPACES[0], DetailConstants.PICTURE_LIST_SPACES[1], + DetailConstants.PICTURE_LIST_SPACES[2]).getValue(this.pageBreakpoint) }) { + ForEach(DetailConstants.PRODUCT_SMALL_RESOURCES, (item: Resource, index: number) => { + ListItem() { + Image(item) + .width(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? ResourceUtil.getCommonImgSize()[3] : + ResourceUtil.getCommonImgSize()[2]) + .height(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? ResourceUtil.getCommonImgSize()[3] : + ResourceUtil.getCommonImgSize()[2]) + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .borderWidth(index === this.currentSwiperIndex ? 1 : 0) + } + }, (item: Resource, index: number) => JSON.stringify(item) + index) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .margin({ + top: $r('app.float.small_picture_margin'), + bottom: $r('app.float.small_picture_margin') + }) + } + .height(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.small_picture_height_lg') : + $r('app.float.small_picture_height')) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + } + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Center) + .padding({ + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[1] ? CommonConstants.BOTTOM_RECT_HEIGHT : 0 + }) + } +} + +@Component +export struct ProductInfo { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Prop pageBreakpoint: string; + + build() { + Column() { + ProductPrice({ pageBreakpoint: this.pageBreakpoint }) + ProductDiscount({ pageBreakpoint: this.pageBreakpoint }) + ProductConfig({ pageBreakpoint: this.pageBreakpoint }) + UserComments() + } + .backgroundColor($r('app.color.products_info')) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + bottom: $r('app.float.product_info_padding_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDiscount.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDiscount.ets new file mode 100644 index 0000000000000000000000000000000000000000..e16dea90ec6f9079a9fa23657ec287b032e1cf72 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductDiscount.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { RightArrow } from './CommonView'; + +@Component +export struct ProductDiscount { + @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[0]) + .fontSize($r('app.float.discount_text_font_1')) + .lineHeight($r('app.float.discount_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .margin({ bottom: $r('app.float.discount_text_margin_1') }) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[1]) + .fontSize($r('app.float.discount_text_font_2')) + .fontColor($r('app.color.products_info_text')) + .lineHeight($r('app.float.discount_text_line')) + .fontWeight(FontWeight.Normal) + .margin({ bottom: $r('app.float.discount_text_margin_2') }) + Row() { + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[2]) + .fontSize($r('app.float.discount_text_font_2')) + .fontColor($r('app.color.products_info_text')) + .fontWeight(FontWeight.Normal) + .margin({ right: $r('app.float.discount_text_margin_3') }) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[3]) + .layoutWeight(1) + .fontSize($r('app.float.discount_text_font_2')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Blank() + RightArrow() + } + .padding({ + left: $r('app.float.discount_row_padding'), + right: $r('app.float.discount_row_padding') + }) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .backgroundColor($r('app.color.products_info_background_1')) + .width(CommonConstants.FULL_PERCENT) + } + .alignItems(HorizontalAlign.Start) + .backgroundColor(Color.White) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding($r('app.float.discount_col_padding')) + .margin({ bottom: new BreakpointType($r('app.float.discount_col_margin_sm'), $r('app.float.discount_col_margin_md'), + $r('app.float.discount_col_margin_lg')).getValue(this.pageBreakpoint) }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductHome.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b8f653c0c37a9b2d68af2cd60bbeccd5f05459e --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductHome.ets @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { AbilityConstant, common, StartOptions, Want } from '@kit.AbilityKit'; +import { BreakpointConstants, CommonConstants, PipWindowUtil, ResourceUtil } from '@ohos/commons'; +import { ProductInfo, ProductPicture } from './ProductDetail'; +import { ProductUtilView } from './ProductUtilView'; +import { DetailTopIcon } from './CommonView'; +import { AllComments } from './ProductConfig'; + +@Component +export struct ProductHome { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('isShowingSidebar') isShowingSidebar: boolean = false; + @StorageLink('isSplitMode') isSplitMode: boolean = false; + @State isMoreDetail: boolean = false; + @State isShoppingBag: boolean = false; + @State isCustomerService: boolean = false; + @State isDialogOpen: boolean = false; + @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[3]; + @State isLiveMoreDetail: boolean = false; + @Consume('pageInfos') pageInfos: NavPathStack; + private pipWindowUtil: PipWindowUtil | undefined = PipWindowUtil.getPipWindowUtil(); + + aboutToDisappear(): void { + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0]) { + if (this.pipWindowUtil === undefined) { + return; + } + this.pipWindowUtil.stopPip(); + } + } + + build() { + NavDestination() { + // [Start product_side_bar_container] + SideBarContainer() { + Column() { + Image($r('app.media.icon_close_4')) + // [StartExclude product_side_bar_container] + .width(ResourceUtil.getCommonImgSize()[1]) + .height(ResourceUtil.getCommonImgSize()[1]) + .onClick(() => { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + this.isShowingSidebar = false; + } + }) + .margin({ + top: $r('app.float.detail_lg_top_row_margin'), + bottom: $r('app.float.detail_lg_top_row_margin') + }) + // [EndExclude product_side_bar_container] + AllComments() + } + .alignItems(HorizontalAlign.End) + .height(CommonConstants.FULL_PERCENT) + .padding({ + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight, + left: $r('app.float.three_column_page_padding'), + right: $r('app.float.three_column_page_padding') + }) + + Row() { + // [StartExclude product_side_bar_container] + if (this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG) { + Column() { + Scroll() { + Column() { + ProductPicture({ pageBreakpoint: this.currentBreakpoint, isMoreLiveDetail: $isLiveMoreDetail }) + ProductInfo({ pageBreakpoint: this.currentBreakpoint }) + } + } + .scrollBar(BarState.Off) + .layoutWeight(1) + + ProductUtilView({ isMoreDetail: $isMoreDetail, isShoppingBag: $isShoppingBag, isCustomerService: + $isCustomerService }) + } + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + .height(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + } else { + Column() { + ProductPicture({ pageBreakpoint: this.currentBreakpoint, isMoreLiveDetail: $isLiveMoreDetail }) + } + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + .height(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + } + + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + Column() { + Row() { + DetailTopIcon({ imageResource: $r('app.media.ic_mate_pad_2') }) + .margin({ right: $r('app.float.detail_top_icon_margin_sm') }) + .onClick(() => { + if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0]) { + return; + } + if (!this.isSplitMode) { + let want: Want = { + bundleName: 'com.huawei.multishoppingpricecomparison', + abilityName: 'SecondAbility' + }; + let option: StartOptions = { windowMode: AbilityConstant.WindowMode.WINDOW_MODE_SPLIT_PRIMARY }; + (this.getUIContext().getHostContext() as common.UIAbilityContext).startAbility(want, option); + } else { + (this.getUIContext().getHostContext() as common.UIAbilityContext).terminateSelf(); + } + }) + DetailTopIcon({ imageResource: $r('app.media.ic_more') }) + } + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .justifyContent(FlexAlign.End) + .width(CommonConstants.FULL_PERCENT) + .margin({ + top: $r('app.float.detail_lg_top_row_margin'), + bottom: $r('app.float.detail_lg_top_row_margin') + }) + + Scroll() { + ProductInfo({ pageBreakpoint: BreakpointConstants.BREAKPOINT_LG }) + } + .align(Alignment.Top) + .scrollBar(BarState.Off) + .layoutWeight(1) + + ProductUtilView({ isMoreDetail: $isMoreDetail, isShoppingBag: $isShoppingBag, isCustomerService: + $isCustomerService }) + } + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + .backgroundColor($r('app.color.products_info')) + .height(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .justifyContent(FlexAlign.Start) + } + // [EndExclude product_side_bar_container] + } + // [StartExclude product_side_bar_container] + .alignItems(VerticalAlign.Top) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(2) + // [EndExclude product_side_bar_container] + } + .showSideBar(this.isShowingSidebar) + .showControlButton(false) + .sideBarPosition(SideBarPosition.End) + .divider({ + strokeWidth: $r('app.float.sidebar_divider_width'), + color: ResourceUtil.getCommonDividerColor() + }) + .minSideBarWidth(this.getUIContext().px2vp(this.windowWidth) / CommonConstants.THREE) + .maxSideBarWidth(this.getUIContext().px2vp(this.windowWidth) / CommonConstants.THREE) + .autoHide(false) + // [End product_side_bar_container] + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductMoreDetail.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductMoreDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d62ec56adf39388eff35a6a4ffee7af09cd5812 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductMoreDetail.ets @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ClassifyConstants, DetailShoppingBagView } from '@ohos/home'; +import { CustomerServiceView } from './CustomerServiceView'; +import { ProductInfo, ProductPicture } from './ProductDetail'; +import { ProductUtilView } from './ProductUtilView'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct ProductMoreDetail { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @State isMoreDetail: boolean = true; + @State isShoppingBag: boolean = false; + @State isCustomerService: boolean = false; + @State isLiveMoreDetail: boolean = false; + @Consume('pageInfos') pageInfos: NavPathStack; + + aboutToAppear(): void { + let navParams: string = JSON.stringify(this.pageInfos.getParamByName(ClassifyConstants.PAGE_INFO_LIST[1])); + if (navParams.includes(DetailConstants.PARAM_STRING_LIST[0])) { + this.isShoppingBag = true; + } + if (navParams.includes(DetailConstants.PARAM_STRING_LIST[1])) { + this.isCustomerService = true; + } + } + + aboutToDisappear(): void { + this.isShoppingBag = false; + this.isCustomerService = false; + } + + build() { + NavDestination() { + // [Start product_more_detail_view] + Row() { + Column() { + // [StartExclude product_more_detail_view] + Scroll() { + Column() { + ProductPicture({ + pageBreakpoint: new BreakpointType(BreakpointConstants.BREAKPOINT_SM, BreakpointConstants.BREAKPOINT_SM, + BreakpointConstants.BREAKPOINT_MD).getValue(this.currentBreakpoint), + isMoreLiveDetail: $isLiveMoreDetail + }) + ProductInfo({ + pageBreakpoint: new BreakpointType(BreakpointConstants.BREAKPOINT_SM, + BreakpointConstants.BREAKPOINT_SM, BreakpointConstants.BREAKPOINT_MD).getValue(this.currentBreakpoint) + }) + } + .margin({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + } + .scrollBar(BarState.Off) + .layoutWeight(1) + + ProductUtilView({ isMoreDetail: $isMoreDetail, isShoppingBag: $isShoppingBag, isCustomerService: + $isCustomerService }) + // [EndExclude product_more_detail_view] + } + .height(CommonConstants.FULL_PERCENT) + // Setting the width ratio of offering details to side panel. + .layoutWeight(new BreakpointType(0, CommonConstants.THREE, CommonConstants.FIVE) + .getValue(this.currentBreakpoint)) + .borderWidth({ right: $r('app.float.more_detail_col_border_width') }) + .borderColor(ResourceUtil.getCommonBorderColor()[0]) + // Hide the product details page under the SM breakpoint. + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.None : Visibility.Visible) + + Column() { + // Check the auxiliary information page of the side panel. + if (this.isShoppingBag) { + DetailShoppingBagView({ isMoreDetail: this.isMoreDetail }) + } + if (this.isCustomerService) { + CustomerServiceView() + } + } + // [StartExclude product_more_detail_view] + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + .height(CommonConstants.FULL_PERCENT) + // [EndExclude product_more_detail_view] + // Setting the width ratio of offering details to side panel. + .layoutWeight(CommonConstants.THREE) + } + // [End product_more_detail_view] + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + .hideTitleBar(true) + .expandSafeArea([SafeAreaType.KEYBOARD]) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductPrice.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductPrice.ets new file mode 100644 index 0000000000000000000000000000000000000000..e05b960c35277ab05622a527260c15c364b86cb4 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductPrice.ets @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { RightArrow } from './CommonView'; + +@Component +export struct ProductPrice { + @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Row() { + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[0]) + .fontSize($r('app.float.product_price_font_1')) + .lineHeight($r('app.float.product_price_line_1')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(Color.White) + .displayPriority(4) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[1]) + .fontSize($r('app.float.product_price_font_2')) + .lineHeight($r('app.float.product_price_line_2')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(Color.White) + .displayPriority(4) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[2]) + .decoration({ + type: TextDecorationType.LineThrough, + color: Color.White + }) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontSize($r('app.float.product_price_font_3')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontColor(Color.White) + .displayPriority(1) + Blank() + .displayPriority(2) + Row() { + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[3]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[4]) + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[5]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[6]) + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[7]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[8]) + } + .displayPriority(3) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.product_price_row_height')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[3]) + .padding({ + left: $r('app.float.product_price_padding_left_right'), + right: $r('app.float.product_price_padding_left_right'), + bottom: $r('app.float.product_price_padding_bottom') + }) + .alignItems(VerticalAlign.Bottom) + .linearGradient({ + direction: GradientDirection.Right, + repeating: false, + colors: [[DetailConstants.GRADIENT_COLORS[0], 0.0], [DetailConstants.GRADIENT_COLORS[1], 1.0]] + }) + + Row() { + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[9]) + .fontSize($r('app.float.product_price_font_3')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.product_price_line_3')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Blank() + RightArrow() + } + .width(CommonConstants.FULL_PERCENT) + .margin({ + top: $r('app.float.price_margin_top'), + bottom: $r('app.float.price_margin_bottom') + }) + + Row() { + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[10]) + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[11]) + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[12]) + Blank() + .displayPriority(2) + Row() { + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[13]) + .fontColor(Color.White) + .fontSize($r('app.float.product_price_font_3')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .displayPriority(1) + .width(this.pageBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? $r('app.float.price_tag_row_width') : + $r('app.float.price_tag_row_width_lg')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .height($r('app.float.price_tag_row_height')) + .backgroundColor($r('app.color.products_info_background_2')) + .justifyContent(FlexAlign.Center) + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.price_tag_row_margin') }) + + Row() { + Image($r('app.media.ic_public_gps')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .width(ResourceUtil.getCommonImgSize()[6]) + .height(ResourceUtil.getCommonImgSize()[6]) + .margin({ right: $r('app.float.price_position_margin') }) + Column() { + Row() { + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[14]) + .fontSize($r('app.float.product_price_font_3')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.product_price_line_3')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Blank() + RightArrow() + } + .width(CommonConstants.FULL_PERCENT) + + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[15]) + .fontSize($r('app.float.product_price_font_3')) + .lineHeight($r('app.float.product_price_line_3')) + .margin({ top: $r('app.float.price_position_margin') }) + } + .layoutWeight(1) + .alignItems(HorizontalAlign.Start) + } + .alignItems(VerticalAlign.Top) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.price_position_row_height')) + } + .alignItems(HorizontalAlign.Start) + .backgroundColor(Color.White) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding($r('app.float.price_col_padding')) + .margin({ + top: this.pageBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? $r('app.float.price_col_margin_top') : 0, + bottom: new BreakpointType($r('app.float.price_col_margin_bottom_sm'), $r('app.float.price_col_margin_bottom_md'), + $r('app.float.price_col_margin_bottom_lg')).getValue(this.pageBreakpoint) }) + } + + @Builder + TimeText(timeText: string) { + Row() { + Text(timeText) + .fontSize($r('app.float.product_price_font_4')) + .lineHeight($r('app.float.product_price_line_4')) + .width($r('app.float.product_price_line_5')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(Color.White) + } + .padding({ + left: $r('app.float.time_text_padding'), + right: $r('app.float.time_text_padding') + }) + .height($r('app.float.time_text_height')) + .width($r('app.float.time_text_width')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[0]) + .backgroundColor($r('app.color.time_tip_background')) + } + + @Builder + TimeTip(tipText: string) { + Text(tipText) + .fontSize($r('app.float.product_price_font_5')) + .lineHeight($r('app.float.product_price_line_5')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(Color.White) + } + + @Builder + ProductTag(tagText: string) { + Row() { + Text(tagText) + .fontSize($r('app.float.product_price_font_4')) + .lineHeight($r('app.float.product_price_line_4')) + .fontColor($r('app.color.service_font_color')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } + .displayPriority(3) + .height($r('app.float.product_tag_row_height')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .borderRadius(ResourceUtil.getCommonBorderRadius()[1]) + .borderColor($r('app.color.price_tag_border_color')) + .borderWidth($r('app.float.product_tag_row_border_width')) + .padding({ + left: $r('app.float.product_tag_row_padding'), + right: $r('app.float.product_tag_row_padding') + }) + .margin({ right: $r('app.float.product_tag_row_margin') }) + .linearGradient({ + direction: GradientDirection.Right, + repeating: false, + colors: [[DetailConstants.GRADIENT_COLORS[2], 0.0], [DetailConstants.GRADIENT_COLORS[3], 1.0]] + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductUtilView.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductUtilView.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1f832530355d4d74b14a71a5a96991f1cd2c9e6 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ProductUtilView.ets @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { ClassifyConstants } from '@ohos/home'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { PayCard } from './PayCard'; +import { UtilIcon } from './CommonView'; + +@Component +export struct ProductUtilView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isShowingSidebar') isShowingSidebar: boolean = false; + @StorageLink('isSplitMode') isSplitMode: boolean = false; + @Link isMoreDetail: boolean; + @Link isShoppingBag: boolean; + @Link isCustomerService: boolean; + @State isDialogOpen: boolean = false; + @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[3]; + @Consume('pageInfos') pageInfos: NavPathStack; + public isLivePage: boolean = false; + // [Start dialog_controller] + private dialogController: CustomDialogController | null = new CustomDialogController({ + builder: PayCardDialog(), + customStyle: true + }); + // [End dialog_controller] + private context: Context = this.getUIContext().getHostContext()! + + aboutToDisappear(): void { + this.dialogController = null; + } + // [Start pay_card_builder] + @Builder + PayCardBuilder() { + Column() { + PayCard({ + // [StartExclude pay_card_builder] + isOpen: $isDialogOpen, + detailType: $detailType, + currentBreakpoint: this.currentBreakpoint + // [EndExclude pay_card_builder] + }) + } + // [StartExclude pay_card_builder] + .padding({ top: $r('app.float.util_pay_padding') }) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + // [EndExclude pay_card_builder] + } + // [End pay_card_builder] + build() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[0], + md: BreakpointConstants.GRID_ROW_COLUMNS[1], + lg: BreakpointConstants.GRID_ROW_COLUMNS[2] + } + }) { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[2], + md: BreakpointConstants.GRID_COLUMN_SPANS[3], + lg: BreakpointConstants.GRID_COLUMN_SPANS[4] + } + }) { + Row() { + UtilIcon({ isMoreDetail: $isMoreDetail, iconImg: $r('app.media.tab_home') }) + .displayPriority(3) + UtilIcon({ isMoreDetail: $isMoreDetail, iconImg: $r('app.media.ic_public_comments') }) + .displayPriority(3) + .onClick(() => { + this.isShowingSidebar = false; + if (this.isMoreDetail) { + this.isCustomerService = true; + this.isShoppingBag = false; + } else { + this.pageInfos.pushPathByName(ClassifyConstants.PAGE_INFO_LIST[1], + new NavParams(DetailConstants.PARAM_STRING_LIST[1])); + } + }) + UtilIcon({ isMoreDetail: $isMoreDetail, iconImg: $r('app.media.tab_shopping_bag') }) + .displayPriority(3 ) + .onClick(() => { + this.isShowingSidebar = false; + if (this.isMoreDetail) { + this.isShoppingBag = true; + this.isCustomerService = false; + } else { + this.pageInfos.pushPathByName(ClassifyConstants.PAGE_INFO_LIST[1], + new NavParams(DetailConstants.PARAM_STRING_LIST[0])); + } + }) + Blank() + .displayPriority(1) + Button(DetailConstants.BUTTON_NAMES(this.context)[0]) + .fontSize($r('app.float.util_button_font')) + .fontColor($r('app.color.util_button_2')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .layoutWeight(this.isMoreDetail ? (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 1 : 2) : + (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? 2 : 1)) + .height($r('app.float.util_button_height')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[7]) + .backgroundColor($r('app.color.util_button_1')) + .margin({ right: $r('app.float.util_button_margin') }) + .displayPriority(2) + // [Start dialog_btn] + Button(DetailConstants.BUTTON_NAMES(this.context)[1]) + // [StartExclude dialog_btn] + .fontSize($r('app.float.util_button_font')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .layoutWeight(1) + .height($r('app.float.util_button_height')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[7]) + .backgroundColor($r('app.color.util_button_2')) + .displayPriority(4) + // [EndExclude dialog_btn] + .bindSheet($$this.isDialogOpen, + this.PayCardBuilder(), { + height: $r('app.float.pay_bind_sheet_height'), + preferType: SheetType.CENTER, + dragBar: false, + enableOutsideInteractive: true, + onDisappear: () => { this.isDialogOpen = false }, + showClose: false, + backgroundColor: $r('app.color.pay_bind_sheet_background') + }) + .onClick(() => { + if (this.isLivePage || this.isSplitMode) { + return; + } + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + this.isDialogOpen = true; + } else { + if (this.dialogController === null) { + return; + } + this.dialogController.open(); + this.isDialogOpen = false; + } + }) + // [End dialog_btn] + } + .backgroundColor($r('app.color.products_info')) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : + CommonConstants.TAB_BAR_HEIGHT + CommonConstants.BOTTOM_RECT_HEIGHT) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : CommonConstants.BOTTOM_RECT_HEIGHT + }) + } + } + .onBreakpointChange((breakPoints) => { + if (breakPoints === BreakpointConstants.BREAKPOINT_LG) { + if (this.dialogController === null) { + return; + } + this.dialogController.close(); + } else { + this.isShowingSidebar = false; + if (this.dialogController === null) { + return; + } + this.dialogController.close(); + this.isDialogOpen = false; + } + }) + } +} +// [Start pay_card_dialog] +@CustomDialog +struct PayCardDialog { + // [StartExclude pay_card_dialog] + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State isDialogOpen: boolean = false; + @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[3]; + private dialogController?: CustomDialogController; + // [EndExclude pay_card_dialog] + + build() { + Column() { + PayCard({ + // [StartExclude pay_card_dialog] + isOpen: $isDialogOpen, + detailType: $detailType, + currentBreakpoint: this.currentBreakpoint, + dialogController: this.dialogController + // [EndExclude pay_card_dialog] + }) + } + // [StartExclude pay_card_dialog] + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + .padding({ top: $r('app.float.pay_dialog_padding') }) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.pay_dialog_width_lg') : + $r('app.float.pay_dialog_width')) + .height(DetailConstants.EIGHTY_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[8]) + // [EndExclude pay_card_dialog] + } +} +// [End pay_card_dialog] +export class NavParams { + viewName: string = ''; + + constructor(viewName: string) { + this.viewName = viewName; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBag.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBag.ets new file mode 100644 index 0000000000000000000000000000000000000000..23aff6d3a0b6ad231a3795fbd4bd815515498019 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBag.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { LiveConstants } from '../constants/LiveConstants'; +import { ShopBagHeader } from './ShopBagHeader'; +import { ShopList } from './ShopList'; + +@Component +export struct ShopBag { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Link isMoreDetail: boolean; + @State currentIndex: number = 0; + @Builder payCardBuilder() {}; + @BuilderParam PayCardButton: () => void = this.payCardBuilder; + private scroller: Scroller = new Scroller(); + private context: Context = this.getUIContext().getHostContext()! + + @Builder + tabBuilder(title: string, targetIndex: number) { + Column() { + Text(title) + .fontColor(this.currentIndex === targetIndex ? $r('app.color.shop_tab_text_color_current') : + $r('app.color.shop_tab_text_color')) + .fontSize($r('app.float.shop_tab_text_size')) + .lineHeight($r('app.float.shop_tab_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .margin({ + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.shop_tab_margin_right_lg') : $r('app.float.shop_tab_margin_right') + }) + } + + build() { + Column() { + ShopBagHeader({ isMoreDetail: this.isMoreDetail }) + Tabs({ barPosition: BarPosition.Start }) { + ForEach(LiveConstants.SHOP_CAR_TABS(this.context), (item: string, index: number) => { + TabContent() { + Scroll(this.scroller) { + ShopList({ PayCardButton: this.PayCardButton }) + } + .align(Alignment.Top) + .scrollBar(BarState.Off) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + .tabBar(this.tabBuilder(item, index)) + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .onChange((index) => { + this.currentIndex = index; + }) + .layoutWeight(1) + .barWidth(CommonConstants.FULL_PERCENT) + .barHeight($r('app.float.shop_tab_height')) + .barMode(BarMode.Scrollable, { margin: 0, nonScrollableLayoutStyle: LayoutStyle.ALWAYS_AVERAGE_SPLIT }) + .fadingEdge(false) + .margin({ + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : CommonConstants.BOTTOM_RECT_HEIGHT + }) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBagHeader.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBagHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..13ef2adbfb65c102ff09a9d5d7e0a255f32d93ea --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopBagHeader.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { ShopCarIcon, ShopCarModel } from '../viewmodel/ShopCarViewModel'; + +@Component +export struct ShopBagHeader { + private shopCarIcons: ShopCarIcon[] = new ShopCarModel(this.getUIContext().getHostContext()!).getShopCarIconList(); + @Link isMoreDetail: boolean; + + build() { + Row() { + Text($r('app.string.pocket_baby')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontSize($r('app.float.bag_name_font_size')) + .lineHeight($r('app.float.bag_name_line_height')) + Blank() + ShopBagIconView({ iconResource: this.shopCarIcons[0].getIcon(), iconName: this.shopCarIcons[0].getName() }) + ShopBagIconView({ iconResource: this.shopCarIcons[1].getIcon(), iconName: this.shopCarIcons[1].getName() }) + ShopBagIconView({ iconResource: this.shopCarIcons[2].getIcon(), iconName: this.shopCarIcons[2].getName() }) + + Image($r('app.media.icon_close_2')) + .width($r('app.float.bag_close_icon_size')) + .aspectRatio(1) + .onClick(() => { + this.isMoreDetail = false; + }) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.shop_tab_height')) + + } +} + +@Component +struct ShopBagIconView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + public iconResource: Resource = $r('app.media.icon_bag'); + public iconName: string = ''; + + build() { + Column() { + Image(this.iconResource) + .width($r('app.float.bag_icon_size')) + .aspectRatio(1) + .margin({ + bottom: $r('app.float.bag_icon_margin_bottom') + }) + Text(this.iconName) + .fontSize($r('app.float.bag_icon_font_size')) + .lineHeight($r('app.float.bag_icon_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .justifyContent(FlexAlign.End) + .width($r('app.float.bag_icon_width')) + .margin({ + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.bag_icon_margin_lg') : $r('app.float.bag_icon_margin_md_sm') + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopList.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopList.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a8f5565f0acbc1d5c4ed9e7ea8c75dfbf01cc39 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/view/ShopList.ets @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { LiveConstants } from '../constants/LiveConstants'; +import { ShopCarModel, ShopCarProduct } from '../viewmodel/ShopCarViewModel'; + +@Component +export struct ShopList { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Builder payCardBuilder() {}; + @BuilderParam PayCardButton:() => void = this.payCardBuilder; + private shopCarProduct: ShopCarProduct[] = new ShopCarModel(this.getUIContext().getHostContext()!).getShopCarProductList(); + + build() { + Column() { + Row() { + Text($r('app.string.preferential_scheme')) + .fontColor(Color.White) + .fontSize($r('app.float.preferential_scheme_font_size')) + .lineHeight($r('app.float.preferential_scheme_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .alignSelf(ItemAlign.Start) + .backgroundColor($r('app.color.preferential_scheme_background_color')) + .height($r('app.float.preferential_scheme_height')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .padding({ + left: $r('app.float.preferential_scheme_padding'), + right: $r('app.float.preferential_scheme_padding') + }) + .margin({ bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.preferential_scheme_margin_lg') : $r('app.float.preferential_scheme_margin') }) + + ForEach(this.shopCarProduct, (item: ShopCarProduct) => { + Row() { + Image(item.getImage()) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.bag_item_image_size_lg') : $r('app.float.bag_item_image_size')) + .aspectRatio(1) + Column() { + Text(item.getName()) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .fontSize($r('app.float.bag_item_name_font_size')) + .margin({ bottom: $r('app.float.bag_item_name_margin_bottom') }) + Text(item.getRemark()) + .fontSize($r('app.float.bag_item_remark_font_size')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .fontColor($r('app.color.bag_item_remark_font_color')) + .margin({ bottom: $r('app.float.bag_item_remark_margin_bottom') }) + Row() { + ForEach(item.getDiscounts(), (discountsItem: string, index: number) => { + Row() { + Text(discountsItem) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.bag_item_discounts_font_color')) + .fontSize($r('app.float.bag_item_discounts_font_size')) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .padding({ + top: $r('app.float.bag_item_discounts_padding_top'), + bottom: $r('app.float.bag_item_discounts_padding_top'), + left: $r('app.float.bag_item_discounts_padding_left'), + right: $r('app.float.bag_item_discounts_padding_left') + }) + .border({ + radius: $r('app.float.bag_item_discounts_border_radius'), + color: $r('app.color.bag_item_discounts_border_color'), + width: $r('app.float.bag_item_discounts_border_width') + }) + .margin({ right: $r('app.float.bag_item_discounts_margin_right') }) + } + .layoutWeight(index > 0 ? 1 : 0) + }, (discountsItem: string, index: number) => discountsItem + index) + } + .width(CommonConstants.FULL_PERCENT) + Blank() + Row() { + Text( LiveConstants.CURRENCY_SYMBOL + JSON.stringify(item.getPrice())) + .fontColor($r('app.color.bag_item_price_color')) + .fontSize($r('app.float.bag_item_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .displayPriority(1) + Blank() + .displayPriority(2) + this.PayCardButton() + } + .width(CommonConstants.FULL_PERCENT) + } + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.bag_item_height_lg') : $r('app.float.bag_item_height')) + .padding({ + top: $r('app.float.bag_item_padding_top'), + bottom: $r('app.float.bag_item_padding_left'), + left: $r('app.float.bag_item_padding_left'), + right: new BreakpointType($r('app.float.bag_item_padding_top'), $r('app.float.bag_item_padding_left'), + $r('app.float.bag_item_padding_top')).getValue(this.currentBreakpoint), + }) + .layoutWeight(1) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + } + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .margin({ bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.bag_item_margin_lg') : $r('app.float.bag_item_margin') }) + }, (item: ShopCarProduct, index: number) => JSON.stringify(item) + index) + } + .width(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/LiveViewModel.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/LiveViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..b25900f7218e5645a6327bcf160989bfb9e7eaaf --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/LiveViewModel.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { LiveConstants } from '../constants/LiveConstants'; + +export class LiveViewModel { + private liveProductList: LiveProduct[] = []; + + constructor() { + LiveConstants.LIVE_PRODUCT_NAME_LIST.forEach((item: string, index: number) => { + this.liveProductList.push(new LiveProduct(item, LiveConstants.LIVE_PRODUCT_IMAGE_LIST[index], + LiveConstants.LIVE_PRODUCT_PRICE_LIST[index])); + }); + } + + getProductList(): LiveProduct[] { + return this.liveProductList; + } +} + +export class LiveProduct { + private name: string; + + private image: Resource; + + private price: string; + + constructor(name: string, image: Resource, price: string) { + this.name = name; + this.image = image; + this.price = price; + } + + getName(): string { + return this.name; + } + + getImage(): Resource { + return this.image; + } + + getPrice(): string { + return this.price; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..167338f9d578bc9e4f29761eee0fd5cedbfda065 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DetailConstants } from '../constants/DetailConstants'; + +export class PayCardViewModel { + private payCardSelectList: SelectProjectItem[] = []; + + constructor(context: Context) { + let selectListTmp:SelectItem[][] = []; + let selectListItemTmp:SelectItem[] = []; + DetailConstants.COLOR_SELECT_NAME_LIST(context).forEach((item: string, index: number) => { + selectListItemTmp.push(new SelectItem(item, DetailConstants.COLOR_SELECT_IMAGE_LIST[index])); + }) + selectListTmp.push(selectListItemTmp); + selectListItemTmp = []; + DetailConstants.CAPACITY_SELECT_NAME_LIST.forEach((item: string)=>{ + selectListItemTmp.push(new SelectItem(item, null)); + }) + selectListTmp.push(selectListItemTmp); + selectListItemTmp = []; + DetailConstants.TYPE_SELECT_NAME_LIST(context).forEach((item: string)=>{ + selectListItemTmp.push(new SelectItem(item, null)); + }) + selectListTmp.push(selectListItemTmp); + selectListItemTmp = []; + DetailConstants.SELECT_NAME_LIST(context).forEach((item: string, index: number) =>{ + this.payCardSelectList.push(new SelectProjectItem(item, selectListTmp[index])); + }) + } + + getPayCardSelectList(): SelectProjectItem[] { + return this.payCardSelectList; + } +} + +export class SelectProjectItem { + private name: string; + + private selectItemList: SelectItem[]; + + constructor(name: string, selectItemList: SelectItem[]) { + this.name = name; + this.selectItemList = selectItemList; + } + + getName(): string { + return this.name; + } + + getSelectItemList(): SelectItem[] { + return this.selectItemList; + } +} + +export class SelectItem { + private name: string; + + private image: Resource | null; + + constructor(name: string, image: Resource | null) { + this.name = name; + this.image = image; + } + + getName(): string { + return this.name; + } + + getImage(): Resource | null { + return this.image; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf1926e03bcfcfbcefac5cc38dff5ee47f745418 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { LiveConstants } from '../constants/LiveConstants'; + +export class ShopCarModel { + private shopCarProductList: ShopCarProduct[] = []; + private shopCarIconList: ShopCarIcon[] = []; + + constructor(context: Context) { + LiveConstants.SHOP_CAR_PRODUCT_NAME_LIST.forEach((item: string, index: number) => { + this.shopCarProductList.push(new ShopCarProduct(LiveConstants.SHOP_CAR_PRODUCT_IMAGE_LIST[index], item, + LiveConstants.SHOP_CAR_PRODUCT_REMARK_LIST(context)[index], + LiveConstants.SHOP_CAR_PRODUCT_DISCOUNTS_LIST(context)[index], + LiveConstants.SHOP_CAR_PRODUCT_PRICE_LIST[index])); + }); + + LiveConstants.SHOP_CAR_ICON_RESOURCES.forEach((item: Resource, index: number) => { + this.shopCarIconList.push(new ShopCarIcon(item, LiveConstants.SHOP_CAR_ICON_NAMES(context)[index])); + }); + } + + getShopCarProductList(): ShopCarProduct[] { + return this.shopCarProductList; + } + + getShopCarIconList(): ShopCarIcon[] { + return this.shopCarIconList; + } +} + +export class ShopCarProduct { + private image: Resource; + private name: string; + private remark: string; + private discounts: string[]; + private price: number; + + constructor(image: Resource, name: string, remark: string, discounts: string[], price: number) { + this.name = name; + this.image = image; + this.remark = remark; + this.discounts = discounts; + this.price = price; + } + + getName(): string { + return this.name; + } + + getImage(): Resource { + return this.image; + } + + getPrice(): number { + return this.price; + } + + getRemark(): string { + return this.remark; + } + + getDiscounts(): string[] { + return this.discounts; + } +} + +export class ShopCarIcon { + private icon: Resource; + private name: string; + + constructor(icon: Resource, name: string) { + this.icon = icon; + this.name = name; + } + + getIcon(): Resource { + return this.icon; + } + + getName(): string { + return this.name; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/module.json5 b/MultiShoppingPriceComparison/features/detail/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..be0ff174b2ab5784cb2979702660f0958dfcb60b --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "detail", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "2in1", + "tablet" + ] + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/color.json b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bc2408bf15ea14fe8f6802d058ebb2fa87d3e90 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/color.json @@ -0,0 +1,132 @@ +{ + "color": [ + { + "name": "living_background", + "value": "#1AFFFFFF" + }, + { + "name": "living_border_color", + "value": "#1A000000" + }, + { + "name": "swiper_indicator_background", + "value": "#66000000" + }, + { + "name": "products_compare", + "value": "#0D000000" + }, + { + "name": "products_info", + "value": "#F1F3F5" + }, + { + "name": "time_tip_background", + "value": "#FFAE0D0D" + }, + { + "name": "products_info_background_1", + "value": "#1ACF0A2C" + }, + { + "name": "products_info_background_2", + "value": "#B3CF0A2C" + }, + { + "name": "products_info_text", + "value": "#CF0A2C" + }, + { + "name": "divider_color", + "value": "#19000000" + }, + { + "name": "config_tip_background", + "value": "#05000000" + }, + { + "name": "util_button_1", + "value": "#0D000000" + }, + { + "name": "util_button_2", + "value": "#CF0A2C" + }, + { + "name": "user_comments_tag_background", + "value": "#0D000000" + }, + { + "name": "pay_bind_sheet_background", + "value": "#F1F3F5" + }, + { + "name": "service_card_font", + "value": "#66000000" + }, + { + "name": "service_font_color", + "value": "#CF0A2C" + }, + { + "name": "message_user_background", + "value": "#1AE64566" + }, + { + "name": "pay_contact_color", + "value": "#99000000" + }, + { + "name": "pay_config_background_selected", + "value": "#0DCF0A2C" + }, + { + "name": "price_tag_border_color", + "value": "#CF0A2C" + }, + { + "name": "comment_background_color", + "value": "#1AFFFFFF" + }, + { + "name": "store_background_color", + "value": "#1AFFFFFF" + }, + { + "name": "shop_price_color", + "value": "#CF0A2C" + }, + { + "name": "shop_tab_text_color", + "value": "#99000000" + }, + { + "name": "shop_tab_text_color_current", + "value": "#000000" + }, + { + "name": "preferential_scheme_background_color", + "value": "#CF0A2C" + }, + { + "name": "bag_item_remark_font_color", + "value": "#66000000" + }, + { + "name": "bag_item_discounts_font_color", + "value": "#D0092D" + }, + { + "name": "bag_item_discounts_border_color", + "value": "#66CF0A2C" + }, + { + "name": "bag_item_price_color", + "value": "#CF0A2C" + }, + { + "name": "pay_button_color", + "value": "#CF0A2C" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/float.json b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..ed865b5be479012edf31659efe9eee795020488b --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/float.json @@ -0,0 +1,1144 @@ +{ + "float": [ + { + "name": "pay_bind_sheet_height", + "value": "620vp" + }, + { + "name": "detail_top_icon_margin_sm", + "value": "16vp" + }, + { + "name": "detail_lg_top_row_margin", + "value": "12vp" + }, + { + "name": "more_detail_col_border_width", + "value": "1vp" + }, + { + "name": "products_config_font", + "value": "12fp" + }, + { + "name": "products_config_line", + "value": "18vp" + }, + { + "name": "right_arrow_width", + "value": "8vp" + }, + { + "name": "right_arrow_height", + "value": "16vp" + }, + { + "name": "config_tip_icon_size", + "value": "10vp" + }, + { + "name": "config_tip_icon_margin", + "value": "4vp" + }, + { + "name": "config_tip_text_font", + "value": "8fp" + }, + { + "name": "util_icon_zero", + "value": "0" + }, + { + "name": "util_icon_width_small", + "value": "32vp" + }, + { + "name": "util_icon_width_sm", + "value": "40vp" + }, + { + "name": "util_icon_width_md", + "value": "60vp" + }, + { + "name": "util_icon_width_lg", + "value": "50vp" + }, + { + "name": "top_icon_right_margin", + "value": "12vp" + }, + { + "name": "customer_service_font", + "value": "20fp" + }, + { + "name": "customer_service_line_height", + "value": "28vp" + }, + { + "name": "more_icon_margin_sm", + "value": "0" + }, + { + "name": "more_icon_margin_md", + "value": "12vp" + }, + { + "name": "more_icon_margin_lg", + "value": "16vp" + }, + { + "name": "service_shop_row_height", + "value": "56vp" + }, + { + "name": "service_shop_row_margin", + "value": "12vp" + }, + { + "name": "service_card_font_1", + "value": "22fp" + }, + { + "name": "service_card_margin", + "value": "8vp" + }, + { + "name": "service_card_font_2", + "value": "12fp" + }, + { + "name": "service_card_line_2", + "value": "16vp" + }, + { + "name": "service_card_font_3", + "value": "14fp" + }, + { + "name": "service_card_line_3", + "value": "18vp" + }, + { + "name": "service_card_margin_3_lg", + "value": "5vp" + }, + { + "name": "service_card_margin_3", + "value": "23vp" + }, + { + "name": "service_button_width_lg", + "value": "72vp" + }, + { + "name": "service_button_width", + "value": "56vp" + }, + { + "name": "service_button_font", + "value": "12fp" + }, + { + "name": "service_card_price_height", + "value": "29vp" + }, + { + "name": "service_card_padding_top", + "value": "12vp" + }, + { + "name": "service_card_padding_bottom", + "value": "16vp" + }, + { + "name": "service_card_padding_left_lg", + "value": "8vp" + }, + { + "name": "service_card_padding_right_lg", + "value": "16vp" + }, + { + "name": "service_card_padding_right", + "value": "12vp" + }, + { + "name": "service_card_height", + "value": "116vp" + }, + { + "name": "service_padding_top_sm", + "value": "16vp" + }, + { + "name": "service_padding_top", + "value": "24vp" + }, + { + "name": "service_util_right_margin_sm", + "value": "16vp" + }, + { + "name": "service_util_right_margin_md", + "value": "12vp" + }, + { + "name": "service_util_right_margin_lg", + "value": "24vp" + }, + { + "name": "text_input_height", + "value": "36vp" + }, + { + "name": "message_image_margin", + "value": "12vp" + }, + { + "name": "message_content_font", + "value": "14fp" + }, + { + "name": "message_content_line", + "value": "18vp" + }, + { + "name": "message_padding_top_bottom", + "value": "8vp" + }, + { + "name": "message_padding_left_right", + "value": "12vp" + }, + { + "name": "message_flex_margin_same", + "value": "8vp" + }, + { + "name": "message_flex_margin", + "value": "12vp" + }, + { + "name": "message_flex_padding", + "value": "48vp" + }, + { + "name": "pay_card_product_margin", + "value": "8vp" + }, + { + "name": "pay_card_price_font", + "value": "24fp" + }, + { + "name": "pay_card_icon_margin", + "value": "6vp" + }, + { + "name": "pay_card_top_margin", + "value": "12vp" + }, + { + "name": "pay_position_margin", + "value": "12vp" + }, + { + "name": "pay_address_margin", + "value": "2vp" + }, + { + "name": "pay_address_font", + "value": "16fp" + }, + { + "name": "pay_contact_font", + "value": "14fp" + }, + { + "name": "pay_info_margin", + "value": "12vp" + }, + { + "name": "pay_info_padding_top_bottom", + "value": "10vp" + }, + { + "name": "pay_info_padding_left_right", + "value": "12vp" + }, + { + "name": "pay_config_title_font", + "value": "14fp" + }, + { + "name": "pay_config_title_margin", + "value": "8vp" + }, + { + "name": "pay_config_title_line", + "value": "19vp" + }, + { + "name": "pay_config_name_font", + "value": "12fp" + }, + { + "name": "pay_config_name_margin", + "value": "12vp" + }, + { + "name": "pay_config_border_width", + "value": "0.5vp" + }, + { + "name": "pay_config_height", + "value": "30vp" + }, + { + "name": "pay_config_margin", + "value": "12vp" + }, + { + "name": "pay_config_col_margin_top", + "value": "20vp" + }, + { + "name": "pay_config_col_margin_bottom", + "value": "12vp" + }, + { + "name": "pay_config_col_padding", + "value": "12vp" + }, + { + "name": "pay_wallet_icon_margin", + "value": "5vp" + }, + { + "name": "pay_wallet_font", + "value": "16fp" + }, + { + "name": "checkbox_width", + "value": "16vp" + }, + { + "name": "wallet_row_padding_1", + "value": "8vp" + }, + { + "name": "wallet_row_padding_2", + "value": "12vp" + }, + { + "name": "wallet_row_margin", + "value": "12vp" + }, + { + "name": "pay_button_height", + "value": "40vp" + }, + { + "name": "pay_button_margin_top", + "value": "16vp" + }, + { + "name": "pay_button_margin_bottom", + "value": "12vp" + }, + { + "name": "products_config_margin_12", + "value": "12vp" + }, + { + "name": "products_config_margin_8", + "value": "8vp" + }, + { + "name": "products_padding_sm", + "value": "12vp" + }, + { + "name": "products_padding_md", + "value": "14vp" + }, + { + "name": "products_padding_lg", + "value": "16vp" + }, + { + "name": "config_tip_row_height", + "value": "32vp" + }, + { + "name": "config_text_col_width", + "value": "24vp" + }, + { + "name": "config_text_col_height", + "value": "36vp" + }, + { + "name": "user_comments_title_font", + "value": "16fp" + }, + { + "name": "user_comments_title_line", + "value": "22vp" + }, + { + "name": "comments_title_margin", + "value": "12vp" + }, + { + "name": "comments_tag_margin", + "value": "16vp" + }, + { + "name": "comments_profile_margin", + "value": "12vp" + }, + { + "name": "comments_user_font", + "value": "12fp" + }, + { + "name": "comments_user_line", + "value": "18vp" + }, + { + "name": "rating_height", + "value": "14vp" + }, + { + "name": "comments_user_row_height", + "value": "36vp" + }, + { + "name": "comments_user_row_margin", + "value": "12vp" + }, + { + "name": "comment_text_font", + "value": "12fp" + }, + { + "name": "comment_text_line", + "value": "16vp" + }, + { + "name": "user_comments_col_padding", + "value": "12vp" + }, + { + "name": "tag_font", + "value": "12fp" + }, + { + "name": "tag_margin", + "value": "12vp" + }, + { + "name": "tag_padding", + "value": "12vp" + }, + { + "name": "tag_row_height", + "value": "32vp" + }, + { + "name": "product_swiper_margin", + "value": "175vp" + }, + { + "name": "picture_icon_margin", + "value": "24vp" + }, + { + "name": "picture_icon_margin_sm", + "value": "16vp" + }, + { + "name": "picture_live_font", + "value": "10fp" + }, + { + "name": "picture_live_line", + "value": "15vp" + }, + { + "name": "picture_live_col_margin_lg", + "value": "58vp" + }, + { + "name": "picture_live_col_height", + "value": "58vp" + }, + { + "name": "picture_live_col_width", + "value": "48vp" + }, + { + "name": "picture_number_font", + "value": "10fp" + }, + { + "name": "picture_number_row_width", + "value": "36vp" + }, + { + "name": "picture_number_row_height", + "value": "16vp" + }, + { + "name": "picture_arrow_width", + "value": "6vp" + }, + { + "name": "picture_arrow_height", + "value": "12vp" + }, + { + "name": "picture_arrow_margin", + "value": "12vp" + }, + { + "name": "picture_indicator_row_padding_left", + "value": "12vp" + }, + { + "name": "picture_indicator_row_padding_right", + "value": "8vp" + }, + { + "name": "picture_indicator_row_width", + "value": "112vp" + }, + { + "name": "picture_indicator_row_height", + "value": "24vp" + }, + { + "name": "picture_indicator_row_margin", + "value": "20vp" + }, + { + "name": "small_picture_margin", + "value": "12vp" + }, + { + "name": "small_picture_height_lg", + "value": "72vp" + }, + { + "name": "small_picture_height", + "value": "60vp" + }, + { + "name": "picture_indicator_font", + "value": "12fp" + }, + { + "name": "picture_indicator_margin", + "value": "2vp" + }, + { + "name": "product_info_padding_bottom", + "value": "12vp" + }, + { + "name": "discount_text_font_1", + "value": "14fp" + }, + { + "name": "discount_text_font_2", + "value": "12fp" + }, + { + "name": "discount_text_line", + "value": "18vp" + }, + { + "name": "discount_text_margin_1", + "value": "8vp" + }, + { + "name": "discount_text_margin_2", + "value": "16vp" + }, + { + "name": "discount_text_margin_3", + "value": "4vp" + }, + { + "name": "discount_row_padding", + "value": "8vp" + }, + { + "name": "discount_col_padding", + "value": "12vp" + }, + { + "name": "discount_col_margin_sm", + "value": "12vp" + }, + { + "name": "discount_col_margin_md", + "value": "14vp" + }, + { + "name": "discount_col_margin_lg", + "value": "16vp" + }, + { + "name": "product_price_font_1", + "value": "14fp" + }, + { + "name": "product_price_font_2", + "value": "22fp" + }, + { + "name": "product_price_font_3", + "value": "12fp" + }, + { + "name": "product_price_font_4", + "value": "10fp" + }, + { + "name": "product_price_font_5", + "value": "9fp" + }, + { + "name": "product_price_line_1", + "value": "18vp" + }, + { + "name": "product_price_line_2", + "value": "28vp" + }, + { + "name": "product_price_line_3", + "value": "16vp" + }, + { + "name": "product_price_line_4", + "value": "14vp" + }, + { + "name": "product_price_line_5", + "value": "12vp" + }, + { + "name": "product_price_row_height", + "value": "54vp" + }, + { + "name": "product_price_padding_left_right", + "value": "8vp" + }, + { + "name": "product_price_padding_bottom", + "value": "16vp" + }, + { + "name": "price_margin_top", + "value": "8vp" + }, + { + "name": "price_margin_bottom", + "value": "10vp" + }, + { + "name": "price_tag_row_width", + "value": "48vp" + }, + { + "name": "price_tag_row_width_lg", + "value": "72vp" + }, + { + "name": "price_tag_row_height", + "value": "20vp" + }, + { + "name": "price_tag_row_margin", + "value": "10vp" + }, + { + "name": "price_position_margin", + "value": "4vp" + }, + { + "name": "price_position_row_height", + "value": "36vp" + }, + { + "name": "price_col_padding", + "value": "12vp" + }, + { + "name": "price_col_margin_top", + "value": "16vp" + }, + { + "name": "price_col_margin_bottom_sm", + "value": "12vp" + }, + { + "name": "price_col_margin_bottom_md", + "value": "14vp" + }, + { + "name": "price_col_margin_bottom_lg", + "value": "15vp" + }, + { + "name": "time_text_padding", + "value": "2vp" + }, + { + "name": "time_text_height", + "value": "16vp" + }, + { + "name": "time_text_width", + "value": "16vp" + }, + { + "name": "product_tag_row_height", + "value": "17vp" + }, + { + "name": "product_tag_row_border_width", + "value": "0.5vp" + }, + { + "name": "product_tag_row_padding", + "value": "6vp" + }, + { + "name": "product_tag_row_margin", + "value": "4vp" + }, + { + "name": "util_pay_padding", + "value": "16vp" + }, + { + "name": "util_button_font", + "value": "16fp" + }, + { + "name": "util_button_height", + "value": "40vp" + }, + { + "name": "util_button_margin", + "value": "12vp" + }, + { + "name": "pay_dialog_padding", + "value": "24vp" + }, + { + "name": "pay_dialog_width_lg", + "value": "480vp" + }, + { + "name": "pay_dialog_width", + "value": "504vp" + }, + { + "name": "comment_font_size", + "value": "16fp" + }, + { + "name": "comment_icon_margin_right_lg", + "value": "24vp" + }, + { + "name": "comment_icon_margin_right_sm_md", + "value": "16vp" + }, + { + "name": "comment_height", + "value": "48vp" + }, + { + "name": "comment_margin_top", + "value": "18vp" + }, + { + "name": "comment_margin_bottom", + "value": "8vp" + }, + { + "name": "live_comment_font_size", + "value": "12fp" + }, + { + "name": "official_review_border_radius", + "value": "4vp" + }, + { + "name": "official_review_padding", + "value": "4vp" + }, + { + "name": "official_review_margin", + "value": "6vp" + }, + { + "name": "comments_line_height", + "value": "20vp" + }, + { + "name": "live_comment_margin_bottom", + "value": "12vp" + }, + { + "name": "live_comment_border_radius", + "value": "8vp" + }, + { + "name": "live_comment_padding", + "value": "6vp" + }, + { + "name": "live_comment_padding_left", + "value": "8vp" + }, + { + "name": "live_mask_padding_right_lg", + "value": "32vp" + }, + { + "name": "live_store_map_size", + "value": "36vp" + }, + { + "name": "live_store_map_margin", + "value": "4vp" + }, + { + "name": "store_name_font_size", + "value": "12fp" + }, + { + "name": "number_of_viewers_font_size", + "value": "10fp" + }, + { + "name": "store_margin_right", + "value": "16vp" + }, + { + "name": "store_margin_top", + "value": "12vp" + }, + { + "name": "store_height", + "value": "36vp" + }, + { + "name": "store_border_radius", + "value": "18vp" + }, + { + "name": "shop_list_space_lg", + "value": "12vp" + }, + { + "name": "shop_list_space_md_sm", + "value": "10vp" + }, + { + "name": "shop_list_image_size_lg", + "value": "72vp" + }, + { + "name": "shop_list_image_size", + "value": "60vp" + }, + { + "name": "shop_list_text_font_size", + "value": "14fp" + }, + { + "name": "shop_list_text_line_height", + "value": "19vp" + }, + { + "name": "shop_list_text_margin_lg", + "value": "6vp" + }, + { + "name": "shop_list_text_margin", + "value": "4vp" + }, + { + "name": "shop_text_padding_top_lg", + "value": "12vp" + }, + { + "name": "shop_text_padding_top", + "value": "8vp" + }, + { + "name": "shop_text_padding_bottom_lg", + "value": "16vp" + }, + { + "name": "shop_text_padding_bottom", + "value": "10vp" + }, + { + "name": "shop_text_padding_left_lg", + "value": "8vp" + }, + { + "name": "shop_width_index0_lg", + "value": "216vp" + }, + { + "name": "shop_width_index0", + "value": "180vp" + }, + { + "name": "shop_width_lg", + "value": "72vp" + }, + { + "name": "shop_width", + "value": "60vp" + }, + { + "name": "shop_tab_text_size", + "value": "16fp" + }, + { + "name": "shop_tab_line_height", + "value": "33vp" + }, + { + "name": "shop_tab_margin_right_lg", + "value": "24vp" + }, + { + "name": "shop_tab_margin_right", + "value": "16vp" + }, + { + "name": "shop_tab_height", + "value": "56vp" + }, + { + "name": "bag_name_font_size", + "value": "16fp" + }, + { + "name": "bag_name_line_height", + "value": "22vp" + }, + { + "name": "bag_close_icon_size", + "value": "24vp" + }, + { + "name": "bag_icon_size", + "value": "20vp" + }, + { + "name": "bag_icon_margin_bottom", + "value": "2vp" + }, + { + "name": "bag_icon_font_size", + "value": "10fp" + }, + { + "name": "bag_icon_line_height", + "value": "14vp" + }, + { + "name": "bag_icon_width", + "value": "36vp" + }, + { + "name": "bag_icon_margin_lg", + "value": "16vp" + }, + { + "name": "bag_icon_margin_md_sm", + "value": "12vp" + }, + { + "name": "preferential_scheme_font_size", + "value": "12fp" + }, + { + "name": "preferential_scheme_line_height", + "value": "16vp" + }, + { + "name": "preferential_scheme_height", + "value": "28vp" + }, + { + "name": "preferential_scheme_padding", + "value": "8vp" + }, + { + "name": "preferential_scheme_margin_lg", + "value": "16vp" + }, + { + "name": "preferential_scheme_margin", + "value": "12vp" + }, + { + "name": "bag_item_image_size_lg", + "value": "124vp" + }, + { + "name": "bag_item_image_size", + "value": "134vp" + }, + { + "name": "bag_item_name_font_size", + "value": "12fp" + }, + { + "name": "bag_item_name_margin_bottom", + "value": "4vp" + }, + { + "name": "bag_item_remark_font_size", + "value": "9fp" + }, + { + "name": "bag_item_remark_margin_bottom", + "value": "5vp" + }, + { + "name": "bag_item_discounts_font_size", + "value": "9fp" + }, + { + "name": "bag_item_discounts_padding_top", + "value": "2vp" + }, + { + "name": "bag_item_discounts_padding_left", + "value": "4vp" + }, + { + "name": "bag_item_discounts_border_radius", + "value": "4vp" + }, + { + "name": "bag_item_discounts_border_width", + "value": "0.5vp" + }, + { + "name": "bag_item_discounts_margin_right", + "value": "5vp" + }, + { + "name": "bag_item_font_size", + "value": "16fp" + }, + { + "name": "bag_item_height_lg", + "value": "124vp" + }, + { + "name": "bag_item_height", + "value": "134vp" + }, + { + "name": "bag_item_padding_top", + "value": "16vp" + }, + { + "name": "bag_item_padding_left", + "value": "12vp" + }, + { + "name": "bag_item_margin_lg", + "value": "16vp" + }, + { + "name": "bag_item_margin", + "value": "12vp" + }, + { + "name": "index_bind_detents", + "value": "534vp" + }, + { + "name": "index_col_padding_top_1", + "value": "8vp" + }, + { + "name": "index_col_padding_top_2", + "value": "16vp" + }, + { + "name": "pay_button_width", + "value": "72vp" + }, + { + "name": "live_pay_button_height", + "value": "28vp" + }, + { + "name": "pay_button_font", + "value": "14fp" + }, + { + "name": "all_comments_font", + "value": "14fp" + }, + { + "name": "all_comments_line", + "value": "19vp" + }, + { + "name": "all_comments_margin", + "value": "7vp" + }, + { + "name": "comment_extra_img_size", + "value": "288vp" + }, + { + "name": "comment_extra_font", + "value": "10fp" + }, + { + "name": "three_column_page_padding", + "value": "32vp" + }, + { + "name": "sidebar_divider_width", + "value": "1vp" + }, + { + "name": "live_video_width_sm", + "value": "360vp" + }, + { + "name": "live_video_width_md", + "value": "328vp" + }, + { + "name": "live_video_width_lg", + "value": "400vp" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/string.json b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c587f2928061d63b96773464cdecf2d717dc0d5c --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/element/string.json @@ -0,0 +1,304 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_placeholder", + "value": "What to say ..." + }, + { + "name": "official_review", + "value": "Official anchor" + }, + { + "name": "store_name", + "value": "Official live broadcast room" + }, + { + "name": "number_of_viewers", + "value": "738,600 people watch" + }, + { + "name": "preferential_scheme", + "value": "XX yuan store universal red envelope" + }, + { + "name": "pocket_baby", + "value": "Pocket goods" + }, + { + "name": "currency_symbol", + "value": "¥ " + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST1", + "value": "Beidou Satellite News | Low -electricity emergency mode" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST2", + "value": "Ultra -thin | Super flat | Ultra -reliable" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST3", + "value": "2.5K high brush eye screen | Light and long battery life" + }, + { + "name": "Gifted_points", + "value": "Gifted points" + }, + { + "name": "flagship_machine", + "value": "The new generation of straight screen flagship machine" + }, + { + "name": "cheaper", + "value": "Performance version of the new product is scheduled for cheaper 200 yuan" + }, + { + "name": "Shopping_bag", + "value": "Shopping bag" + }, + { + "name": "search", + "value": "search" + }, + { + "name": "Order", + "value": "Order" + }, + { + "name": "all", + "value": "all" + }, + { + "name": "phone", + "value": "Phone" + }, + { + "name": "mac", + "value": "Tablet" + }, + { + "name": "PC", + "value": "PC" + }, + { + "name": "watch", + "value": "Watch" + }, + { + "name": "earphone", + "value": "Earphone" + }, + { + "name": "LIVE_COMMENTS_LIST1", + "value": "Farters of outstanding consciousness, wisdom to see everything. The new product of Huawei Mate60 Pro series was released." + }, + { + "name": "LIVE_COMMENTS_LIST2", + "value": "123xxxxxx published comments, published comments, published comments and comments!" + }, + { + "name": "LIVE_COMMENTS_LIST3", + "value": "Congratulations to 123xxxxxx to get the official spike discount!" + }, + { + "name": "buy_now", + "value": "Buy now" + }, + { + "name": "living", + "value": "Living" + }, + { + "name": "store", + "value": "Huawei official flagship store" + }, + { + "name": "buy", + "value": "Buy" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS1", + "value": "HUAWEI MATE X5 12GB+512GB Phantom ultra-light four folding ultra-high-definition high-resolution two-screen super smart rhino communication" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS2", + "value": "Hello! Want to consult the latest mobile phone released this fall ~" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS3", + "value": "Hello, smart customer service assistant will serve you!" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS4", + "value": "Welcome to the Huawei official mall. In order to improve the quality of service, your consultation may be recorded. At present, there are fewer store customer service. It is recommended that you give priority to obtaining product information through the product details page or Huawei official website. If the smart customer service cannot solve your problem, you can enter \"manual\" to contact artificial customer service. Thank you for your understanding and support ~" + }, + { + "name": "COLOR_SELECT_NAME_LIST1", + "value": "Phantom Purple" + }, + { + "name": "COLOR_SELECT_NAME_LIST2", + "value": "Feather Sand Black" + }, + { + "name": "COLOR_SELECT_NAME_LIST3", + "value": "Feather Sand White" + }, + { + "name": "COLOR_SELECT_NAME_LIST4", + "value": "Qing Shan Dai" + }, + { + "name": "Official_standard", + "value": "Official standard" + }, + { + "name": "add_cart", + "value": "Add to cart" + }, + { + "name": "SELECT_NAME_LIST1", + "value": "Body color" + }, + { + "name": "SELECT_NAME_LIST2", + "value": "Storage capacity" + }, + { + "name": "SELECT_NAME_LIST3", + "value": "Package Type" + }, + { + "name": "pay_info1", + "value": "XXXX Avenue XXXX Building XX Unit XX" + }, + { + "name": "pay_info2", + "value": "Contact +8610000000000" + }, + { + "name": "pay_info3", + "value": "Huawei Wallet Payment" + }, + { + "name": "pay_info4", + "value": "Pay now" + }, + { + "name": "PRODUCT_CONFIG_NAMES1", + "value": "Selected" + }, + { + "name": "PRODUCT_CONFIG_NAMES2", + "value": "Phantom Purple · 512GB · Instant Delivery in Stock" + }, + { + "name": "PRODUCT_CONFIG_NAMES3", + "value": "Suggest" + }, + { + "name": "PRODUCT_CONFIG_NAMES5", + "value": "Recycle" + }, + { + "name": "PRODUCT_CONFIG_NAMES6", + "value": "High-priced recycling sends more re-subsidies" + }, + { + "name": "PRODUCT_CONFIG_NAMES7", + "value": "Free shipping for orders over 48 yuan" + }, + { + "name": "PRODUCT_CONFIG_NAMES8", + "value": "Products, shipping invoices, and after-sales services provided by Huawei terminals" + }, + { + "name": "USER_COMMENT_NAMES1", + "value": "User reviews (1500+)" + }, + { + "name": "USER_COMMENT_NAMES2", + "value": "Most Popular 77" + }, + { + "name": "USER_COMMENT_NAMES3", + "value": "Content 858" + }, + { + "name": "USER_COMMENT_NAMES4", + "value": "There is Figures 217" + }, + { + "name": "USER_COMMENT_NAMES5", + "value": "Y**********" + }, + { + "name": "USER_COMMENT_NAMES6", + "value": "Huawei phones have good battery life, clear camera performance, smooth operation, and powerful functions. The key is their outstanding appearance, which is highly recommended!" + }, + { + "name": "USER_COMMENT_NAMES7", + "value": "All reviews" + }, + { + "name": "USER_COMMENT_NAMES8", + "value": "Yaojin Black, 256GB, in stock quick delivery" + }, + { + "name": "compare", + "value": "Compare" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES1", + "value": "【 Stock Quick Release 】 HUAWEI Mate X5 12GB+512GB Phantom Purple" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES2", + "value": "【 Huawei Super New Product Season 】 1. Limited edition purchase with a smart window protection case worth 299 yuan 2. Student authentication discount of 100 yuan (click down to learn more) 3. Trade in for new up to 500 yuan subsidy | More selected phones click to learn>>Ultra clear mirror dual screen | Ultra thin four fold folding" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES3", + "value": "Limited edition gift with unlimited earphones, Vitality Edition" + }, + { + "name": "PRODUCT_PRICE_NAMES1", + "value": "There are still" + }, + { + "name": "PRODUCT_PRICE_NAMES2", + "value": "Enjoy up to 12 periods of interest with 0 installments" + }, + { + "name": "PRODUCT_PRICE_NAMES3", + "value": "Premium" + }, + { + "name": "PRODUCT_PRICE_NAMES4", + "value": "¥800 off" + }, + { + "name": "PRODUCT_PRICE_NAMES5", + "value": "Trade in subsidy" + }, + { + "name": "PRODUCT_PRICE_NAMES6", + "value": "P.P" + }, + { + "name": "PRODUCT_PRICE_NAMES7", + "value": "Longgang District, Shenzhen City, Guangdong Province" + }, + { + "name": "PRODUCT_PRICE_NAMES8", + "value": "Spot" + }, + { + "name": "PRODUCT_CONFIG_NAMES4", + "value": " 推荐" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/comment_picture.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/comment_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..d4ebbb3c1f8fded3fa837e16a313293e32d35ff6 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/comment_picture.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_back.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..6a9c5278c37dfc51c244707ec429be034c087793 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_back.svg @@ -0,0 +1,25 @@ + + + back + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_1.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..3d0decc78855fab7f1735f954671b5c5ab68556d --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_1.svg @@ -0,0 +1,19 @@ + + + MatePad + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_2.png new file mode 100644 index 0000000000000000000000000000000000000000..06731dc26829e0405abe7c5ba12fd5effb6a51bd Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_mate_pad_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_more.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..1c1ee7ec5d40a5794dd65ee83435bbe633cfe9de --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_more.svg @@ -0,0 +1,25 @@ + + + more + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_add.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_add.svg new file mode 100644 index 0000000000000000000000000000000000000000..d9cd20bc03fb535b6973c4f068b74752adc170bb --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_add.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_close.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..ac485ef36a8d7376bc340c6450a80400cf7d3ab3 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_close.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_emoji.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_emoji.svg new file mode 100644 index 0000000000000000000000000000000000000000..ba60cf2cc88529fe297cedd4dad76afffad2959a --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_emoji.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_gps.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_gps.svg new file mode 100644 index 0000000000000000000000000000000000000000..9eb7df260ff3cb3a87f7d2c47a30f1be746d21f8 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_gps.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_gps + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_highlightsed.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_highlightsed.svg new file mode 100644 index 0000000000000000000000000000000000000000..0a253bb1ce80ac9867424ab530ef288c8e66afef --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_highlightsed.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_collected + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_living.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_living.png new file mode 100644 index 0000000000000000000000000000000000000000..43c8ace17422a2ca71c629c970d14802d129770d Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_living.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_more.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..c4325c770545c0370732ab073f88c9df8d372d00 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_todo.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_todo.svg new file mode 100644 index 0000000000000000000000000000000000000000..5452b4e670e93eea4ad7308d70b914c30755c1bb --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_todo.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_todo + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_voice.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_voice.svg new file mode 100644 index 0000000000000000000000000000000000000000..bbd9e35461fa7c11939681ef64d6c2ac08d946dd --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_public_voice.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_zoom_out.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_zoom_out.png new file mode 100644 index 0000000000000000000000000000000000000000..0b068493d486fefb6aa543563a7f7fecbee69a89 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/ic_zoom_out.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_bag.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_bag.svg new file mode 100644 index 0000000000000000000000000000000000000000..f55cc3b9e90c2d0cbf5639494f7c16719bcb2c4b --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_bag.svg @@ -0,0 +1,24 @@ + + + Public/ic_favourites + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_cart.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_cart.png new file mode 100644 index 0000000000000000000000000000000000000000..a94b2113825634cc420e69232f6fa05223c927a0 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_cart.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_1.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..ac485ef36a8d7376bc340c6450a80400cf7d3ab3 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_1.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_2.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..860458282b473157754dda949d3ddf81c850f252 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_2.svg @@ -0,0 +1,23 @@ + + + Panel/item/close btn + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_3.png new file mode 100644 index 0000000000000000000000000000000000000000..d3908f63779042ad37bd26d3bc470ce68d267426 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_4.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_4.png new file mode 100644 index 0000000000000000000000000000000000000000..e226e06abf449470829dd8b9dd30c9d21606fdc7 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_close_4.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_like.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_like.png new file mode 100644 index 0000000000000000000000000000000000000000..7cb00e83b27f5b6ddc8f58f8a54384ddfb199f33 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_like.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_order.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_order.svg new file mode 100644 index 0000000000000000000000000000000000000000..20459c675a9f0de04dc8d934a8f55cb5ecd51105 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_order.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_pay.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_pay.png new file mode 100644 index 0000000000000000000000000000000000000000..3603b121e69e1b606bb7ff1322b0f840ee42802b Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_pay.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_position.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_position.svg new file mode 100644 index 0000000000000000000000000000000000000000..dce430afd6e27232b9ab22791a09c9644bce8570 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_position.svg @@ -0,0 +1,27 @@ + + + gaps + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_search.svg b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..7ac6a320589a9cd496f7d8dd0e7dd59b3c39b2f0 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_search.svg @@ -0,0 +1,24 @@ + + + Public/ic_favourites + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_share.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_share.png new file mode 100644 index 0000000000000000000000000000000000000000..6e95de47377893c2250d31f7fcf375b99e20e27c Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_share.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_split.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_split.png new file mode 100644 index 0000000000000000000000000000000000000000..b945723471268665045f28b13ff99933552d1117 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/icon_split.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..f692089714ed53fe4c2b157a2ce9d4b6f6d9a102 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4c8f025b2697c0882b88e8b3956b12cdc87a913e Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..9f4f2041613677eb710631b25ff367d7c0e2d3e1 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_4.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..f45a01d5d73afb6ca0f0fd403dfe10772cec41f9 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_bag_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..4397dd43825ce2c176a6fa488def0ddea1da6fd3 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a7d53f3f68c8d2a9eea8919c5190a9bc5f671155 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..22eca5d2f22a5fcc2568fee7e6b41ec1b4db87f7 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_4.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..c399e10330c7cc9ae47e3672d0676c951f453ad5 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_5.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_5.png new file mode 100644 index 0000000000000000000000000000000000000000..f4905f2905a4cd7091f900b1f791d7faeb6bc81a Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_5.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_6.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_6.png new file mode 100644 index 0000000000000000000000000000000000000000..7f132076623e593ada67d42ce931adbbd8806a9a Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_6.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_7.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_7.png new file mode 100644 index 0000000000000000000000000000000000000000..c5aaee15f952913c115955b9aa19eb38d1df46e5 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_7.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_8.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_8.png new file mode 100644 index 0000000000000000000000000000000000000000..77aecfd053333a69c61563994b98259ccdba874c Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_product_8.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_vmall.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_vmall.png new file mode 100644 index 0000000000000000000000000000000000000000..eed9cb48594939dcb40f3f18d1929eefbc311418 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/live_vmall.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_main_shop.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_main_shop.png new file mode 100644 index 0000000000000000000000000000000000000000..eb91615aa1cced5b0d53f75d5d3e01633a18e88d Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_main_shop.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..17ce2e451c909614ed798d1a2f410595512ad5a4 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4485ab56a5448a4041cb0b66f6c5e26429618ac6 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..7af8583a034dad5166b1962b9c73af646f07979c Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_4.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..ef28d49781630de6843cc4836db451bb14856735 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/pay_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_1.png new file mode 100644 index 0000000000000000000000000000000000000000..b64117a3d4862dd16298bbc27b3ac904bcb7e128 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_2.png new file mode 100644 index 0000000000000000000000000000000000000000..7bfa0666989a15081b92a84a6633a93344a49823 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_3.png new file mode 100644 index 0000000000000000000000000000000000000000..163d2260024f6e1aca73ad501ffe9640177fa5c7 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_detail_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_1.png new file mode 100644 index 0000000000000000000000000000000000000000..e3f2a904250908b8a7c4b70ca4e27c29462ff833 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_2.png new file mode 100644 index 0000000000000000000000000000000000000000..5938f70521f7e79e922bb14229dd2a70244e30cd Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4847b8ff737be631edbbc62251dd389ec4a2549a Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/product_small_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_1.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_1.png new file mode 100644 index 0000000000000000000000000000000000000000..6b27128107e822e235cd3002487c4188d841ce89 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_1.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_2.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_2.png new file mode 100644 index 0000000000000000000000000000000000000000..2b0274711d23acf6633baa674f715953121fe31c Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_2.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_3.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_3.png new file mode 100644 index 0000000000000000000000000000000000000000..545809a65fb071d3bf07c07752c7fd4eb1e3139e Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_3.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_4.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_4.png new file mode 100644 index 0000000000000000000000000000000000000000..d4c5c8af5c3242b014cb24c7391c1b8770ea684b Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/recommended_config_4.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_logo.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..50d38e46af32dae2e8825ffbcbc3e737bd3df158 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_logo.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_product.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_product.png new file mode 100644 index 0000000000000000000000000000000000000000..966482ade88d8e7819c349ddb27cd832a916137e Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/shop_product.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/user_profile.png b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/user_profile.png new file mode 100644 index 0000000000000000000000000000000000000000..14765cd72378cda7719df879a69bbc1108dceb33 Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/base/media/user_profile.png differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/en_US/element/string.json b/MultiShoppingPriceComparison/features/detail/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fd9038c472bfdcfb9533b7a173b589401489c166 --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/en_US/element/string.json @@ -0,0 +1,304 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_placeholder", + "value": "What to say ..." + }, + { + "name": "official_review", + "value": "official" + }, + { + "name": "store_name", + "value": "Official live broadcast room" + }, + { + "name": "number_of_viewers", + "value": "738,600 people watch" + }, + { + "name": "preferential_scheme", + "value": "XX yuan store universal red envelope" + }, + { + "name": "pocket_baby", + "value": "Pocket" + }, + { + "name": "currency_symbol", + "value": "¥ " + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST1", + "value": "BeiDou Msg | Low Batt Emergency" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST2", + "value": "Thin, Flat, Reliable" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST3", + "value": "2.5K HR Screen | Light & Long Battery" + }, + { + "name": "Gifted_points", + "value": "Gift points" + }, + { + "name": "flagship_machine", + "value": "New straight-screen flagship" + }, + { + "name": "cheaper", + "value": "Pre-order & save $200 on performance ed." + }, + { + "name": "Shopping_bag", + "value": "Shopping bag" + }, + { + "name": "search", + "value": "search" + }, + { + "name": "Order", + "value": "Order" + }, + { + "name": "all", + "value": "All" + }, + { + "name": "phone", + "value": "Phone" + }, + { + "name": "mac", + "value": "Tablet" + }, + { + "name": "PC", + "value": "PC" + }, + { + "name": "watch", + "value": "Watch" + }, + { + "name": "earphone", + "value": "Earphone" + }, + { + "name": "LIVE_COMMENTS_LIST1", + "value": "Visionary & Intelligent. Recap of Mate 60 Pro launch." + }, + { + "name": "LIVE_COMMENTS_LIST2", + "value": "123XXXXXX posted multiple comments!" + }, + { + "name": "LIVE_COMMENTS_LIST3", + "value": "Congrats, 123XXXXXX! Flash sale discount won!" + }, + { + "name": "buy_now", + "value": "Buy now" + }, + { + "name": "living", + "value": "Living" + }, + { + "name": "store", + "value": "Huawei official flagship store" + }, + { + "name": "buy", + "value": "Buy" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS1", + "value": "HUAWEI Mate X5 12GB+512GB Phantom Purple: Ultra-thin Fold, HD Dual Screens, Smart Comm." + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS2", + "value": "Hello! Want to consult the latest mobile phone released this fall ~" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS3", + "value": "Hello, smart customer service assistant will serve you!" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS4", + "value": "Welcome to the Huawei official mall. In order to improve the quality of service, your consultation may be recorded. At present, there are fewer store customer service. It is recommended that you give priority to obtaining product information through the product details page or Huawei official website. If the smart customer service cannot solve your problem, you can enter \"manual\" to contact artificial customer service. Thank you for your understanding and support ~" + }, + { + "name": "COLOR_SELECT_NAME_LIST1", + "value": "Phantom Purple" + }, + { + "name": "COLOR_SELECT_NAME_LIST2", + "value": "Feather Black" + }, + { + "name": "COLOR_SELECT_NAME_LIST3", + "value": "Feather White" + }, + { + "name": "COLOR_SELECT_NAME_LIST4", + "value": "Mountain Green" + }, + { + "name": "Official_standard", + "value": "Official std config" + }, + { + "name": "add_cart", + "value": "Add to Cart" + }, + { + "name": "SELECT_NAME_LIST1", + "value": "color" + }, + { + "name": "SELECT_NAME_LIST2", + "value": "Storage capacity" + }, + { + "name": "SELECT_NAME_LIST3", + "value": "Package type" + }, + { + "name": "pay_info1", + "value": "Room XX, Unit XX, Building XXXXX, XXXX Avenue" + }, + { + "name": "pay_info2", + "value": "Contact: +8610000000000" + }, + { + "name": "pay_info3", + "value": "Huawei Wallet Payment" + }, + { + "name": "pay_info4", + "value": "Pay now" + }, + { + "name": "PRODUCT_CONFIG_NAMES1", + "value": "Selected" + }, + { + "name": "PRODUCT_CONFIG_NAMES2", + "value": "Phantom Purple 512GB, Fast Ship" + }, + { + "name": "PRODUCT_CONFIG_NAMES3", + "value": "Pair" + }, + { + "name": "PRODUCT_CONFIG_NAMES5", + "value": "Recycle" + }, + { + "name": "PRODUCT_CONFIG_NAMES6", + "value": "High recycling, extra subsidies" + }, + { + "name": "PRODUCT_CONFIG_NAMES7", + "value": "Free ship over 48 yuan" + }, + { + "name": "PRODUCT_CONFIG_NAMES8", + "value": "Huawei Terminal: products, shipping, service" + }, + { + "name": "USER_COMMENT_NAMES1", + "value": "User reviews (1500+)" + }, + { + "name": "USER_COMMENT_NAMES2", + "value": "Top 77" + }, + { + "name": "USER_COMMENT_NAMES3", + "value": "858 contents" + }, + { + "name": "USER_COMMENT_NAMES4", + "value": "217 imgs" + }, + { + "name": "USER_COMMENT_NAMES5", + "value": "JI**********" + }, + { + "name": "USER_COMMENT_NAMES6", + "value": "Huawei phones: long battery, clear cams, smooth ops, strong feats, stunning looks. Highly recommend!" + }, + { + "name": "USER_COMMENT_NAMES7", + "value": "All reviews" + }, + { + "name": "USER_COMMENT_NAMES8", + "value": "Gold Black 256GB, Fast Ship" + }, + { + "name": "compare", + "value": "Compare" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES1", + "value": "[In Stock & Fast Shipping] HUAWEI Mate X5 12GB+512GB Phantom Purple" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES2", + "value": "[Huawei New Season]1、Gift: ¥299 Smart Case (Ltd)2、Student Discount: ¥1003、Trade-in: Up to ¥500 | More Phones >> Ultra-clear Screens, Ultra-slim Fold" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES3", + "value": "Limited Giveaway: Free Infinity Earphones (Vitality Edition)" + }, + { + "name": "PRODUCT_PRICE_NAMES1", + "value": "Time remaining until the end:" + }, + { + "name": "PRODUCT_PRICE_NAMES2", + "value": "Enjoy up to 12 interest-free installments" + }, + { + "name": "PRODUCT_PRICE_NAMES3", + "value": "Boutique" + }, + { + "name": "PRODUCT_PRICE_NAMES4", + "value": "Direct ¥800 off (Ltd Time)" + }, + { + "name": "PRODUCT_PRICE_NAMES5", + "value": "Trade-in subsidy" + }, + { + "name": "PRODUCT_PRICE_NAMES6", + "value": "Disc." + }, + { + "name": "PRODUCT_PRICE_NAMES7", + "value": "Longgang, Shenzhen, Guangdong" + }, + { + "name": "PRODUCT_PRICE_NAMES8", + "value": "In stock" + }, + { + "name": "PRODUCT_CONFIG_NAMES4", + "value": "Rec. " + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/rawfile/live.mp4 b/MultiShoppingPriceComparison/features/detail/src/main/resources/rawfile/live.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..8c7d73919b0f63a1023ecfad95d35efbe2e599cf Binary files /dev/null and b/MultiShoppingPriceComparison/features/detail/src/main/resources/rawfile/live.mp4 differ diff --git a/MultiShoppingPriceComparison/features/detail/src/main/resources/zh_CN/element/string.json b/MultiShoppingPriceComparison/features/detail/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c35d5249a59c5f3cec8f1df06aeeb8474fd55a7e --- /dev/null +++ b/MultiShoppingPriceComparison/features/detail/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,304 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_placeholder", + "value": "说点什么…" + }, + { + "name": "official_review", + "value": "官方主播" + }, + { + "name": "store_name", + "value": "官方直播间" + }, + { + "name": "number_of_viewers", + "value": "73.86万人观看" + }, + { + "name": "preferential_scheme", + "value": "XX元店铺通用红包" + }, + { + "name": "pocket_baby", + "value": "口袋宝贝" + }, + { + "name": "currency_symbol", + "value": "¥ " + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST1", + "value": "北斗卫星消息|低电量应急模式" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST2", + "value": "超轻薄|超平整|超可靠" + }, + { + "name": "OP_CAR_PRODUCT_REMARK_LIST3", + "value": "2.5K高刷护眼屏|轻薄长续航" + }, + { + "name": "Gifted_points", + "value": "赠积分" + }, + { + "name": "flagship_machine", + "value": "新一代直屏旗舰机" + }, + { + "name": "cheaper", + "value": "性能版新品预定立省200" + }, + { + "name": "Shopping_bag", + "value": "购物袋" + }, + { + "name": "search", + "value": "搜索" + }, + { + "name": "Order", + "value": "订单" + }, + { + "name": "all", + "value": "全部" + }, + { + "name": "phone", + "value": "手机" + }, + { + "name": "mac", + "value": "平板" + }, + { + "name": "PC", + "value": "笔记本" + }, + { + "name": "watch", + "value": "手表" + }, + { + "name": "earphone", + "value": "耳机" + }, + { + "name": "LIVE_COMMENTS_LIST1", + "value": "远见卓识,智见万象。华为Mate60 Pro系列新品发布精彩回顾。" + }, + { + "name": "LIVE_COMMENTS_LIST2", + "value": "123XXXXXX发表评论发表评论发表评论发表评论!" + }, + { + "name": "LIVE_COMMENTS_LIST3", + "value": "恭喜123XXXXXX获得官方秒杀优惠!" + }, + { + "name": "buy_now", + "value": "立即购买" + }, + { + "name": "living", + "value": "直播中" + }, + { + "name": "store", + "value": "华为官方旗舰店" + }, + { + "name": "buy", + "value": "购买" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS1", + "value": "HUAWEI Mate X5 12GB+512GB 幻影紫 超轻薄四曲折叠 超高清高分辨率临境双屏 超智慧灵犀通信" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS2", + "value": "您好!想咨询一下今年秋季最新发布的手机~" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS3", + "value": "您好,智能客服助手为您服务!" + }, + { + "name": "CUSTOMER_SERVICE_CONTENTS4", + "value": "欢迎光临华为官方商城,为提升服务质量,您的咨询可能会被记录。目前店铺客服数量较少,建议您优先通过商品详情页或华为官网获取商品信息,若智能客服无法解决您的问题,您可以输入“人工”联系人工客服。感谢您的理解和支持~" + }, + { + "name": "COLOR_SELECT_NAME_LIST1", + "value": "幻影紫" + }, + { + "name": "COLOR_SELECT_NAME_LIST2", + "value": "羽砂黑" + }, + { + "name": "COLOR_SELECT_NAME_LIST3", + "value": "羽砂白" + }, + { + "name": "COLOR_SELECT_NAME_LIST4", + "value": "青山黛" + }, + { + "name": "Official_standard", + "value": "官方标配" + }, + { + "name": "add_cart", + "value": "加入购物袋" + }, + { + "name": "SELECT_NAME_LIST1", + "value": "机身颜色" + }, + { + "name": "SELECT_NAME_LIST2", + "value": "储存容量" + }, + { + "name": "SELECT_NAME_LIST3", + "value": "套餐类型" + }, + { + "name": "pay_info1", + "value": "XXXX大道XXXXX楼XX单元XX号" + }, + { + "name": "pay_info2", + "value": "联系人 +8610000000000" + }, + { + "name": "pay_info3", + "value": "华为钱包支付" + }, + { + "name": "pay_info4", + "value": "立即支付" + }, + { + "name": "PRODUCT_CONFIG_NAMES1", + "value": "已选" + }, + { + "name": "PRODUCT_CONFIG_NAMES2", + "value": "幻影紫·512GB·现货速发" + }, + { + "name": "PRODUCT_CONFIG_NAMES3", + "value": "搭配" + }, + { + "name": "PRODUCT_CONFIG_NAMES4", + "value": "推荐" + }, + { + "name": "PRODUCT_CONFIG_NAMES5", + "value": "回收" + }, + { + "name": "PRODUCT_CONFIG_NAMES6", + "value": "高价回收送多重新补贴" + }, + { + "name": "PRODUCT_CONFIG_NAMES7", + "value": "满48元包邮" + }, + { + "name": "PRODUCT_CONFIG_NAMES8", + "value": "由华为终端提供商品、发货开票及售后服务" + }, + { + "name": "USER_COMMENT_NAMES1", + "value": "用户评价(1500+)" + }, + { + "name": "USER_COMMENT_NAMES2", + "value": "最热门77" + }, + { + "name": "USER_COMMENT_NAMES3", + "value": "有内容858" + }, + { + "name": "USER_COMMENT_NAMES4", + "value": "有图217" + }, + { + "name": "USER_COMMENT_NAMES5", + "value": "几**********" + }, + { + "name": "USER_COMMENT_NAMES6", + "value": "华为手机续航很好,拍照清晰,运行畅快,功能也很强大,关键是颜值出众,非常值得推荐!" + }, + { + "name": "USER_COMMENT_NAMES7", + "value": "全部评价" + }, + { + "name": "USER_COMMENT_NAMES8", + "value": "曜金黑,256GB,现货速发" + }, + { + "name": "compare", + "value": "机型对比" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES1", + "value": "【现货速发】HUAWEI Mate X5 12GB+512GB 幻影紫" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES2", + "value": "【华为超级新品季】1.限量买赠价值299元智能视窗保护套 2.学生认证优惠100元(下拉了了解详情)3.以旧换新至高补贴500元|更多甄选手机点击了解>>超清临镜双屏|超轻薄四曲折叠" + }, + { + "name": "PRODUCT_DISCOUNT_NAMES3", + "value": "限量赠无限耳机活力版" + }, + { + "name": "PRODUCT_PRICE_NAMES1", + "value": "距离结束还剩" + }, + { + "name": "PRODUCT_PRICE_NAMES2", + "value": "最高可享12期0分期利息" + }, + { + "name": "PRODUCT_PRICE_NAMES3", + "value": "精品" + }, + { + "name": "PRODUCT_PRICE_NAMES4", + "value": "限时直降800元" + }, + { + "name": "PRODUCT_PRICE_NAMES5", + "value": "以旧换新补贴" + }, + { + "name": "PRODUCT_PRICE_NAMES6", + "value": "优惠" + }, + { + "name": "PRODUCT_PRICE_NAMES8", + "value": "现货" + }, + { + "name": "PRODUCT_PRICE_NAMES7", + "value": "广东 深圳市 龙岗区" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/Index.ets b/MultiShoppingPriceComparison/features/home/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ac3f1d0a4b0c85d3649f10c230fce10139e9f9d --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/Index.ets @@ -0,0 +1,3 @@ +export { Home } from './src/main/ets/view/Home'; +export { DetailShoppingBagView } from './src/main/ets/view/ShoppingBagContent'; +export { ClassifyConstants } from './src/main/ets/constants/ClassifyConstants'; \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/build-profile.json5 b/MultiShoppingPriceComparison/features/home/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..14d5b832c7c04a429ed7da4c443d19c2566a4f25 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/build-profile.json5 @@ -0,0 +1,8 @@ +{ + "apiType": "stageMode", + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/hvigorfile.ts b/MultiShoppingPriceComparison/features/home/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiShoppingPriceComparison/features/home/oh-package.json5 b/MultiShoppingPriceComparison/features/home/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..65a9d0afed949b7dea80a06ddc3e157bffb8e6aa --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "home", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ClassifyConstants.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ClassifyConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..3000ccacc0c7d35012fc8bc4e58db8fb068d2df8 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ClassifyConstants.ets @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 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 class ClassifyConstants { + /** + * Navigation list. + */ + static readonly NAV_ROUTER_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST1')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST2')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST3')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST4')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST5')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST6')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST7')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST8')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST9')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST10')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST11')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST12')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST13')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST14')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST15'))]; + /** + * Shop Matrix. + */ + static readonly SHOP_MATRIX: Array> = [ + ['Mate 60 Pro+', 'Mate 60', 'Mate 60 Pro', 'Mate X5'], + ['Mate 60 Pro+', 'Mate 60', 'Mate 60 Pro', 'Mate X5', 'Mate X3', 'Mate 50', 'Mate 50 Pro', 'Mate Xs 2', 'Mate 50E', + 'Mate 50 RS'], + ['P60 ', 'P60 Pro', 'P60 Art ', 'P50 Pro', 'P50E', 'P50 Pocket']]; + /** + * Shop title list. + */ + static readonly SHOP_TITLE_LIST = (context: Context): Array => [ + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST1')), + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST2')), + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST3'))]; + /** + * Shop matrix image. + */ + static readonly SHOP_MATRIX_IMAGE: Array> = [ + [$r('app.media.classify_product_1'), $r('app.media.classify_product_2'), $r('app.media.classify_product_3'), + $r('app.media.classify_product_4')], + [$r('app.media.classify_product_1'), $r('app.media.classify_product_2'), $r('app.media.classify_product_3'), + $r('app.media.classify_product_4'), $r('app.media.classify_product_5'), $r('app.media.classify_product_6'), + $r('app.media.classify_product_7'), $r('app.media.classify_product_8'), $r('app.media.classify_product_9'), + $r('app.media.classify_product_10')], + [$r('app.media.classify_product_11'), $r('app.media.classify_product_12'), $r('app.media.classify_product_13'), + $r('app.media.classify_product_14'), $r('app.media.classify_product_15'), $r('app.media.classify_product_16')]]; + /** + * Banner images. + */ + static readonly BANNER_IMAGE: Array = [$r('app.media.classify_banner1'), $r('app.media.classify_banner2'), + $r('app.media.classify_banner3')]; + /** + * Banner image scale. + */ + static readonly BANNER_IMAGE_RATIO: number = 2.32; + /** + * Number of pictures displayed in the banner. + */ + static readonly SWIPER_DISPLAY_COUNT: number[] = [1, 2, 3]; + /** + * Interval of swiper. + */ + static readonly SWIPER_ITEM_SPACE: number[] = [0, 12, 16]; + /** + * Interval of swiper. + */ + static readonly SWIPER_DIVIDER_WIDTH: string = '2vp'; + /** + * Input prompt. + */ + static readonly INPUT_PROMPT_STRING = + (context: Context): string => context.resourceManager.getStringSync($r('app.string.search')); + /** + * Grid row gutters. + */ + static readonly GRID_ROW_GUTTERS: number[] = [24, 8, 16, 12]; + /** + * Page info list. + */ + static readonly PAGE_INFO_LIST: string[] = ['liveHome', 'moreDetail', 'productHome']; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/constants/HomeConstants.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..91ff629425b6588adb5fabb75ceeec177cdb40e6 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/HomeConstants.ets @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2024 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 class HomeConstants { + /** + * Footer tab topics. + */ + static readonly FOOTER_TOPIC_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST1')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST2')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST3')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST4')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST5'))]; + /** + * Footer topic icons. + */ + static readonly FOOTER_TOPIC_ICONS: Resource[] = [$r('app.media.tab_home'), $r('app.media.tab_classification'), + $r('app.media.tab_discovery'), $r('app.media.tab_shopping_bag'), $r('app.media.tab_mine')]; + /** + * Footer topic icons. + */ + static readonly FOOTER_TOPIC_ICONS_SELECTED: Resource[] = [$r('app.media.tab_home_selected'), + $r('app.media.tab_classification_selected'), $r('app.media.tab_discovery_selected'), + $r('app.media.tab_shopping_bag_selected'), $r('app.media.tab_mine_selected')]; + /** + * Top bar text list. + */ + static readonly TOP_BAR_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS2')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS3')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS4'))]; + /** + * Search placeholder. + */ + static readonly SEARCH_PLACEHOLDER = (context: Context): string => + context.resourceManager.getStringSync($r('app.string.searching')); + /** + * Recommended product list. + */ + static readonly RECOMMENDED_PRODUCTS: Resource[] = [$r('app.media.recommended_product_1'), + $r('app.media.recommended_product_2'), $r('app.media.recommended_product_3'), + $r('app.media.recommended_product_4')]; + /** + * Recommended product is living list. + */ + static readonly RECOMMENDED_PRODUCT_LIVING: boolean[] = [true, false, true, false]; + /** + * Good categories. + */ + static readonly GOOD_CATEGORIES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES1')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES2')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES3')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES4')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES5')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES6')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES7')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES8')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES9')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES10'))]; + /** + * Good category images. + */ + static readonly GOOD_CATEGORY_IMG: Resource[] = [$r('app.media.categories_1'), $r('app.media.categories_2'), + $r('app.media.categories_3'), $r('app.media.categories_4'), $r('app.media.categories_5'), + $r('app.media.categories_6'), $r('app.media.categories_7'), $r('app.media.categories_8'), + $r('app.media.categories_9'), $r('app.media.categories_10')]; + /** + * Category list space list. + */ + static readonly CATEGORY_LIST_SPACES: string[] = ['0', '36vp', '72vp']; + /** + * Category divider stroke width. + */ + static readonly CATEGORY_DIVIDER_STROKE_WIDTH: string = '4vp'; + /** + * Category list item width list. + */ + static readonly CATEGORY_LIST_ITEM_WIDTHS: string[] = ['20%', '64vp', '68vp']; + /** + * Recommended product item space list. + */ + static readonly RECOMMENDED_PRODUCT_ITEM_SPACES: string[] = ['16vp', '12vp']; + /** + * Recommended product view margin list. + */ + static readonly RECOMMENDED_PRODUCT_VIEW_SPACES: number[] = [12, 16, 24, 32]; + /** + * Welfare products. + */ + static readonly WELFARE_PRODUCTS: string[] = ['1299', '899', '599', '2499', '6988', '1799', '988', '6999']; + /** + * Welfare product images. + */ + static readonly WELFARE_PRODUCT_IMG: Resource[] = [$r('app.media.welfare_product_1'), + $r('app.media.welfare_product_2'), $r('app.media.welfare_product_3'), $r('app.media.welfare_product_4'), + $r('app.media.welfare_product_5'), $r('app.media.welfare_product_6'), $r('app.media.welfare_product_7'), + $r('app.media.welfare_product_8')]; + /** + * Price unit. + */ + static readonly PRICE_UNIT = (context: Context): string[] => ['¥', + context.resourceManager.getStringSync($r('app.string.PRICE_UNIT'))]; + /** + * Home title list. + */ + static readonly HOME_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.HOME_TITLES1')), + context.resourceManager.getStringSync($r('app.string.HOME_TITLES2')), + context.resourceManager.getStringSync($r('app.string.HOME_TITLES3'))]; + /** + * Home button text list. + */ + static readonly BUTTON_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS2'))]; + /** + * Welfare tip text. + */ + static readonly TIP_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS2')), + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS3'))]; + /** + * Gradient color list. + */ + static readonly GRADIENT_COLORS: string[] = ['#4DEDAA68', '#33FFE9C1', '#FF6354', '#EA1559']; + /** + * Section product image list. + */ + static readonly SECTION_PRODUCT_IMAGES: Resource[] = [$r('app.media.section_product_1'), + $r('app.media.section_product_2'), $r('app.media.section_product_3'), $r('app.media.section_product_4'), + $r('app.media.section_product_5')]; + /** + * Section products title list. + */ + static readonly SECTION_PRODUCTS_TITLES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES1'))], + ['HUAWEI Mate 50', + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES2'))], + ['Sound X NEW'], ['HUAWEI MatePad Air'], ['HUAWEI MateBook 14s']]; + /** + * Section products info list. + */ + static readonly SECTION_PRODUCTS_INFO = (context: Context): string[] => ['', + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), '', + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO2')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO3'))]; + /** + * Section products price list. + */ + static readonly SECTION_PRODUCTS_PRICES: string[] = ['¥10999', '¥4999', '¥2499', '¥2599', '¥8399']; + /** + * Section products feature list. + */ + static readonly SECTION_PRODUCTS_FEATURES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES1'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES2'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES3'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES4'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES5'))]]; + /** + * Section products comment list. + */ + static readonly SECTION_PRODUCTS_COMMENTS = (context: Context): string => + context.resourceManager.getStringSync($r('app.string.HOME_REVIEW')); + /** + * Welfare grid column gutter list. + */ + static readonly WELFARE_GRID_COL_GUTTERS: number[] = [10, 12, 8, 4]; + /** + * Selection image aspect ratio. + */ + static readonly SELECTION_IMG_ASPECT_RATIO: number = 1.29; + /** + * Flash sale product image list. + */ + static readonly FLASH_SALE_PRODUCT_IMAGES: Resource[] = [$r('app.media.flash_sale_product_1'), + $r('app.media.flash_sale_product_2'), $r('app.media.flash_sale_product_3'), $r('app.media.flash_sale_product_4'), + $r('app.media.flash_sale_product_4'), $r('app.media.flash_sale_product_4')]; + /** + * Flash sale product title list. + */ + static readonly FLASH_SALE_PRODUCT_TITLES = (context: Context): string[][] => [['HUAWEI Mate 50'], ['Mate Xs 2'], + ['HUAWEI nova \u200B1\u200B0', + context.resourceManager.getStringSync($r('app.string.Hot_Seller'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))]]; + /** + * Flash sale product info list. + */ + static readonly FLASH_SALE_PRODUCT_INFO = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO6')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO4')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + ]; + /** + * Flash sale product feature list. + */ + static readonly FLASH_SALE_PRODUCT_FEATURES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES1')), + context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES2'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES3'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES4'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))]]; + /** + * Flash sale product price list. + */ + static readonly FLASH_SALE_PRODUCT_PRICES: string[] = ['¥4999', '¥9999', '¥2949', '¥4899', '¥4899', '¥4899']; + /** + * Flash sale original price list. + */ + static readonly FLASH_SALE_PRODUCT_ORIGINAL_PRICES: string[] = ['¥5488', '', '¥2999', '¥4999', '¥4999', '¥4999']; + /** + * Flash sale image percent. + */ + static readonly FLASH_SALE_IMAGE_PERCENT: number[] = [0.41, 0.44]; + /** + * Flash sale introduction column height. + */ + static readonly FLASH_SALE_INTRO_COL_HEIGHT: number = 134; + /** + * Home header list spaces. + */ + static readonly HOME_HEADER_LIST_SPACES: number[] = [14, 16, 32]; + /** + * Nine. + */ + static readonly NINE: number = 9; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ShoppingBagConstants.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ShoppingBagConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..31cce83705e22c74b21470d25a6c1905074790ab --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/constants/ShoppingBagConstants.ets @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Context } from "@kit.AbilityKit"; + +export class ShoppingBagConstants { + /** + * Product names. + */ + static readonly PRODUCT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')) + ]; + /** + * Product types. + */ + static readonly PRODUCT_TYPE_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIS2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')) + ]; + /** + * Product images. + */ + static readonly PRODUCT_IMAGE_LIST: Resource[] = [$r('app.media.shopping_card_1'), + $r('app.media.shopping_card_2'), $r('app.media.shopping_card_3'), $r('app.media.shopping_card_1')]; + /** + * Product preferential list. + */ + static readonly PRODUCT_PREFERENTIALList_LIST = (context: Context): Array> => [ + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))]]; + /** + * Product price list. + */ + static readonly PRODUCT_PRICE_LIST: number[] = [6199, 6999, 6099, 6199]; + /** + * Product original price list. + */ + static readonly PRODUCT_ORIGINAL_PRICE_LIST: number[] = [6999, -1, 6999, 6999]; + /** + * Product present list. + */ + static readonly PRODUCT_PRESENT_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')) + ]; + /** + * Product service list. + */ + static readonly PRODUCT_SERVICE_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')) + ]; + /** + * Preference details title. + */ + static readonly PREFERENCE_DETAILS_TITLE = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE12')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE2')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE4')) + ]; + /** + * Preference details price. + */ + static readonly PREFERENCE_DETAILS_PRICE: string[] = ['13999', '-800', '-200', '-1000', '12999']; + /** + * Shopping bag layout weight list. + */ + static readonly SHOPPING_BAG_LAYOUT_WEIGHTS: number[] = [35, 24]; + /** + * Shopping bag titles. + */ + static readonly SHOPPING_BAG_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES1')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES2')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES3'))]; + /** + * Shopping discount title list. + */ + static readonly SHOPPING_DISCOUNT_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE5')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE6')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE7')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE8')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE9')) + ]; + /** + * Shopping card foot title list. + */ + static readonly SHOPPING_CARD_FOOT_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES1')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES2')), + '¥', '1299', + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES3')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES4'))]; + /** + * Shopping card name list. + */ + static readonly SHOPPING_CARD_NAMES = (context: Context): string[] => ['¥', '-', '1', '+', + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE10')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE11')), + ]; +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/Categories.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Categories.ets new file mode 100644 index 0000000000000000000000000000000000000000..31cd13effcbd09b3c463062a87b52a5aef89d3d0 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Categories.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { IconInfo, IconInfoViewModel } from '../viewmodel/IconInfoViewModel'; + +@Component +export struct Categories { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State isNextCategory: boolean = false; + private context: Context = this.getUIContext().getHostContext()! + private categoryIcons: IconInfo[] = new IconInfoViewModel(this.context).getCategoryList(); + + build() { + Column() { + List({ space: new BreakpointType(HomeConstants.CATEGORY_LIST_SPACES[0], HomeConstants.CATEGORY_LIST_SPACES[1], + HomeConstants.CATEGORY_LIST_SPACES[2]).getValue(this.currentBreakpoint) }) { + ForEach(this.categoryIcons, (item: IconInfo) => { + ListItem() { + Row() { + Column() { + Image(item.getIcon()) + .height(new BreakpointType($r('app.float.category_img_size_sm'), $r('app.float.category_img_size_md'), + $r('app.float.category_img_size_lg')).getValue(this.currentBreakpoint)) + Text(item.getInfo()) + .fontSize($r('app.float.category_text_font')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.category_text_line')) + } + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .justifyContent(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? FlexAlign.Center : + FlexAlign.Start) + } + .width(new BreakpointType(HomeConstants.CATEGORY_LIST_ITEM_WIDTHS[0], + HomeConstants.CATEGORY_LIST_ITEM_WIDTHS[1], HomeConstants.CATEGORY_LIST_ITEM_WIDTHS[2]). + getValue(this.currentBreakpoint)) + .height(new BreakpointType($r('app.float.category_item_height_sm'), $r('app.float.category_item_height_md'), + $r('app.float.category_item_height_lg')).getValue(this.currentBreakpoint)) + }, (item: IconInfo, index: number) => JSON.stringify(item) + index) + } + .lanes(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? 2 : 1, + $r('app.float.category_lanes_gutter')) + .listDirection(Axis.Horizontal) + .scrollBar(BarState.Off) + .width(CommonConstants.FULL_PERCENT) + .height(new BreakpointType($r('app.float.category_list_height_sm'), $r('app.float.category_list_height_md'), + $r('app.float.category_list_height_lg')).getValue(this.currentBreakpoint)) + .onScrollIndex((start: number, end: number) => { + if (end === HomeConstants.NINE) { + this.isNextCategory = true; + } + if (start === 0) { + this.isNextCategory = false; + } + }) + + if (this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_SM) { + Row() { + Divider() + .color(this.isNextCategory ? $r('app.color.categories_divider_color_selected') : + $r('app.color.categories_divider_color')) + .width($r('app.float.category_divider_width')) + .strokeWidth(HomeConstants.CATEGORY_DIVIDER_STROKE_WIDTH) + .lineCap(LineCapStyle.Round) + Divider() + .color(this.isNextCategory ? $r('app.color.categories_divider_color') : + $r('app.color.categories_divider_color_selected')) + .width($r('app.float.category_divider_width')) + .strokeWidth(HomeConstants.CATEGORY_DIVIDER_STROKE_WIDTH) + .lineCap(LineCapStyle.Round) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.category_divider_row_height')) + .justifyContent(FlexAlign.Center) + .margin({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + } + } + .height(new BreakpointType($r('app.float.category_col_height_sm'), $r('app.float.category_col_height_md'), + $r('app.float.category_col_height_lg')).getValue(this.currentBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .margin({ + top: this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? $r('app.float.category_col_margin') : 0, + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r("app.float.category_col_margin_sm") : 0 + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyContent.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f924c3747b76268b6995ce1814c8b73b8685a0e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyContent.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ClassifyHeader } from './ClassifyHeader'; +import { ClassifyConstants } from '../constants/ClassifyConstants'; +import { ClassifyNavDestination } from './ClassifyNavdestinationPhone'; + +@Component +export struct ClassifyContent { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Provide('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State currentClassifyIndex: number = 0; + private context: Context = this.getUIContext().getHostContext()! + + @Builder + PageMap(name: string) { + if (name === ClassifyConstants.NAV_ROUTER_LIST(this.context)[0]) { + ClassifyNavDestination({ name: name }) + } else { + NavDestination() + .hideTitleBar(true) + } + } + + aboutToAppear(): void { + this.pageInfo.pushPath({ name: ClassifyConstants.NAV_ROUTER_LIST(this.context)[0] }, false); + } + + build() { + Column() { + ClassifyHeader() + // [Start navigation_mode_split] + Navigation(this.pageInfo) { + // [StartExclude navigation_mode_split] + List() { + ForEach(ClassifyConstants.NAV_ROUTER_LIST(this.context), (item: string, index: number) => { + ListItem() { + Stack({ alignContent: Alignment.Start }) { + Row() { + Text(item) + .fontSize($r('app.float.classify_navigation_font_size')) + .lineHeight($r('app.float.classify_navigation_line_height')) + .fontWeight(FontWeight.Normal) + .fontColor(this.currentClassifyIndex === index ? $r('app.color.classify_indicator_selected_color') : + $r('app.color.classify_navigation_font_color')) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + .onClick(() =>{ + this.currentClassifyIndex = index; + if(this.pageInfo.size() !== 0) { + this.pageInfo.pop(); + } + this.pageInfo.pushPath({ name: item }, false); + }) + + Divider() + .vertical(true) + .strokeWidth(ClassifyConstants.SWIPER_DIVIDER_WIDTH) + .height($r('app.float.classify_navigation_line_height')) + .color($r('app.color.classify_navigation_divider_color')) + .visibility(index === this.currentClassifyIndex ? Visibility.Visible : Visibility.None) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.classify_navigation_bar_height')) + .margin({ bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[1] && index === + ClassifyConstants.NAV_ROUTER_LIST.length - 1 ? CommonConstants.BOTTOM_RECT_HEIGHT : 0 }) + } + }, (item: string, index: number) => item + index) + } + .scrollBar(BarState.Off) + // [EndExclude navigation_mode_split] + } + .layoutWeight(1) + // Setting the double column view of the navigation. + .mode(NavigationMode.Split) + // Initialize the width of the navigation bar. + .navBarWidth(new BreakpointType($r('app.float.classify_navigation_bar_width_sm'), + $r('app.float.classify_navigation_bar_width_md'), $r('app.float.classify_navigation_bar_width_lg')) + .getValue(this.currentBreakpoint)) + // Set the minimum width and maximum width of the navigation bar under different breakpoints to be the same. + .navBarWidthRange([new BreakpointType($r('app.float.classify_navigation_bar_width_sm'), + $r('app.float.classify_navigation_bar_width_md'), $r('app.float.classify_navigation_bar_width_lg')) + .getValue(this.currentBreakpoint), new BreakpointType($r('app.float.classify_navigation_bar_width_sm'), + $r('app.float.classify_navigation_bar_width_md'), $r('app.float.classify_navigation_bar_width_lg')) + .getValue(this.currentBreakpoint)]) + // [End navigation_mode_split] + .hideToolBar(true) + .hideTitleBar(true) + .navDestination(this.PageMap) + } + .backgroundColor(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.color.classify_navigation_content_color_sm') : $r('app.color.classify_navigation_content_color')) + .height(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyHeader.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..e71bafcd9ae6b9f947388032fd84d79c82263366 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyHeader.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ClassifyConstants } from '../constants/ClassifyConstants'; + +@Component +export struct ClassifyHeader { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Row() { + Row() { + Stack({ alignContent: Alignment.Start }) { + TextInput({ placeholder: ClassifyConstants.INPUT_PROMPT_STRING(this.context) }) + .placeholderFont({ + size: $r('app.float.classify_header_input_font_size'), + weight: FontWeight.Normal + }) + .placeholderColor($r('app.color.classify_header_input_placeholder')) + .backgroundColor($r('app.color.classify_header_input_background')) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? CommonConstants.FULL_PERCENT : + $r('app.float.classify_header_input_width')) + .height($r('app.float.classify_header_input_height')) + .fontSize($r('app.float.classify_header_input_font_size')) + .padding({ + left: $r('app.float.classify_header_input_padding_left'), + right: $r('app.float.classify_header_input_padding_right') + }) + Image($r('app.media.ic_public_search')) + .width($r('app.float.classify_header_input_search_size')) + .height($r('app.float.classify_header_input_search_size')) + .margin({ left:$r('app.float.classify_header_input_search_margin') }) + } + .layoutWeight(1) + + Image($r('app.media.ic_public_comments')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.classify_header_image_margin_sm') : $r('app.float.classify_header_image_margin') }) + } + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? CommonConstants.FULL_PERCENT : + $r('app.float.classify_header_row_width')) + .padding({ + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.classify_header_padding_left_sm') : $r('app.float.classify_header_padding'), + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.classify_header_padding_right_sm') : $r('app.float.classify_header_padding') + }) + } + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : + CommonConstants.TAB_BAR_HEIGHT + this.topRectHeight) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? FlexAlign.Center : FlexAlign.End) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyNavdestinationPhone.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyNavdestinationPhone.ets new file mode 100644 index 0000000000000000000000000000000000000000..4537e1607b445dc2529dbe98bb499434b64abb98 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyNavdestinationPhone.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants } from '@ohos/commons'; +import { ClassifyShopList } from '../view/ClassifyShopList'; +import { BannerList } from '../viewmodel/ShopListViewModel'; +import { ClassifyConstants } from '../constants/ClassifyConstants'; + +@Component +export struct ClassifyNavDestination { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State name: string = ""; + private scroller: Scroller = new Scroller(); + + build() { + NavDestination() { + Column() { + Scroll(this.scroller) { + Column() { + Row() { + ClassifyBanner() + } + .width(CommonConstants.FULL_PERCENT) + .padding({ right: new BreakpointType($r('app.float.classify_banner_padding_right_sm'), + $r('app.float.classify_banner_padding_right_md'), $r('app.float.classify_banner_padding_right_lg')) + .getValue(this.currentBreakpoint) }) + + ClassifyShopList() + } + .padding({ bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[1] ? 0 : + CommonConstants.BOTTOM_RECT_HEIGHT }) + } + .scrollBarWidth(0) + .padding({ + top: $r('app.float.classify_destination_padding_top'), + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.classify_destination_padding_left_sm') : $r('app.float.classify_destination_padding_left') + }) + } + } + .hideTitleBar(true) + .backgroundColor(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.color.classify_navigation_content_color_sm'): $r('app.color.classify_navigation_content_color')) + } +} + +@Component +export struct ClassifyBanner { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private swiperController: SwiperController = new SwiperController(); + private bannerList: Array = new BannerList().getBannerList(); + + build() { + Swiper(this.swiperController) { + ForEach(this.bannerList, (item: Resource) => { + Image(item) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.classify_banner_height')) + .aspectRatio(ClassifyConstants.BANNER_IMAGE_RATIO) + }, (item: Resource, index: number) => JSON.stringify(item) + index) + } + .loop(true) + .indicator( + this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + Indicator.dot() + .itemWidth($r('app.float.classify_swiper_indicator_width')) + .itemHeight($r('app.float.classify_swiper_indicator_height')) + .selectedItemWidth($r('app.float.classify_swiper_indicator_selected_width')) + .selectedItemHeight($r('app.float.classify_swiper_indicator_selected_height')) + .color($r('app.color.classify_indicator_color')) + .selectedColor($r('app.color.classify_indicator_selected_color')) : false + ) + .displayCount(new BreakpointType(ClassifyConstants.SWIPER_DISPLAY_COUNT[0], + ClassifyConstants.SWIPER_DISPLAY_COUNT[1], ClassifyConstants.SWIPER_DISPLAY_COUNT[2]) + .getValue(this.currentBreakpoint)) + .nextMargin(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD ? + $r('app.float.classify_swiper_next_margin_md') : 0) + .itemSpace(new BreakpointType(ClassifyConstants.SWIPER_ITEM_SPACE[0], ClassifyConstants.SWIPER_ITEM_SPACE[1], + ClassifyConstants.SWIPER_ITEM_SPACE[2]).getValue(this.currentBreakpoint)) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyShopList.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyShopList.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0745e4eff0ebf00d67ffa605f178e4b28f633b0 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ClassifyShopList.ets @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ClassifyConstants } from '../constants/ClassifyConstants'; +import { ShopListViewModel, ShopListItem, ShopItem } from '../viewmodel/ShopListViewModel'; + +@Component +export struct ClassifyShopList { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! + private shopList: ShopListViewModel = new ShopListViewModel(this.context); + + build() { + List() { + ForEach(this.shopList.getShopList(), (item: ShopListItem) => { + ListItem() { + Column() { + Row() { + Text(item.getName()) + .font({ + size: $r('app.float.shop_list_font'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + .textAlign(TextAlign.Start) + } + .height($r('app.float.shop_list_row_height')) + .width(CommonConstants.FULL_PERCENT) + + GridRow({ + columns: new BreakpointType(BreakpointConstants.GRID_ROW_COLUMNS[5], + BreakpointConstants.GRID_ROW_COLUMNS[6], BreakpointConstants.GRID_ROW_COLUMNS[1]) + .getValue(this.currentBreakpoint), + gutter:{ + x: ClassifyConstants.GRID_ROW_GUTTERS[0], + y: new BreakpointType(ClassifyConstants.GRID_ROW_GUTTERS[1], ClassifyConstants.GRID_ROW_GUTTERS[2], + ClassifyConstants.GRID_ROW_GUTTERS[3]).getValue(this.currentBreakpoint) + } + }){ + ForEach(item.getItem(), (item: ShopItem) =>{ + GridCol({ span: 1 }){ + Column(){ + Image(item.getImage()) + .width(CommonConstants.FULL_PERCENT) + .aspectRatio(1) + Text(item.getName()) + .fontSize($r('app.float.list_name_font')) + .fontWeight(FontWeight.Normal) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } + .onClick(() => { + this.pageInfos.pushPath({ name: ClassifyConstants.PAGE_INFO_LIST[2] }); + }) + } + }, (item: ShopItem, index: number) => JSON.stringify(item) + index) + } + .padding({ + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.shop_grid_padding') : + 0, + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.shop_grid_padding') : + 0, + }) + } + .backgroundColor(Color.White) + .border({ radius: ResourceUtil.getCommonBorderRadius()[6] }) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_col_padding_lg') : + $r('app.float.shop_col_padding'), + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_col_padding_lg') : + $r('app.float.shop_col_padding'), + bottom: $r('app.float.shop_col_padding') + }) + .margin({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.shop_col_margin_lg') : + $r('app.float.shop_col_margin') + }) + } + }, (item: ShopListItem, index: number) => JSON.stringify(item) + index) + } + .padding({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + .margin({ bottom: $r('app.float.shop_list_margin') }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/CommonView.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/CommonView.ets new file mode 100644 index 0000000000000000000000000000000000000000..0648ac135e114410f5668c502b7e9223aa7c3bca --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/CommonView.ets @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct HomeButton { + public buttonText: string = ''; + + build() { + Button(this.buttonText) + .backgroundColor($r('app.color.button_color')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .height($r('app.float.button_height')) + .width($r('app.float.button_width')) + .fontColor(Color.White) + .fontSize($r('app.float.button_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } +} + +@Component +export struct TitleView { + public titleText: string = ''; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Row() { + Text(this.titleText) + .fontSize($r('app.float.title_font')) + .lineHeight($r('app.float.title_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + Blank() + + Text(HomeConstants.TIP_TEXTS(this.context)[1]) + .fontSize($r('app.float.title_tip_font')) + .lineHeight($r('app.float.title_tip_line')) + .fontWeight(FontWeight.Normal) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Image(ResourceUtil.getArrowRight()) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.title_height')) + .padding({ + left: $r('app.float.title_view_padding'), + right: $r('app.float.title_view_padding') + }) + } +} + +@Component +export struct ProductTitle { + @State isCenter: boolean = true; + public title: string[] = []; + + build() { + Row() { + if (this.title.length !== 1) { + Text(this.title[1]) + .lineHeight($r('app.float.section_tip_text_line')) + .fontSize($r('app.float.section_tip_text_size')) + .fontColor(Color.White) + .fontWeight(FontWeight.Normal) + .linearGradient({ + direction: GradientDirection.Right, + repeating: false, + colors: [[HomeConstants.GRADIENT_COLORS[2], 0.0], [HomeConstants.GRADIENT_COLORS[3], 1.0]] + }) + .backgroundColor($r('app.color.section_tip_background')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[1]) + .textAlign(TextAlign.Center) + .padding({ + left: $r('app.float.section_tip_text_padding'), + right: $r('app.float.section_tip_text_padding') + }) + .margin({ right: $r('app.float.section_tip_text_margin') }) + } + Text(this.title[0]) + .fontSize($r('app.float.section_title_text_size')) + .lineHeight($r('app.float.section_title_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .layoutWeight(this.isCenter ? 0 : 1) + } + .justifyContent(this.isCenter ? FlexAlign.Center : FlexAlign.Start) + } +} + +@Component +export struct ProductInfo { + public info: string = ''; + + build() { + if (this.info === '') { + Blank() + .height($r('app.float.section_info_text_line')) + } else { + Text(this.info) + .fontSize($r('app.float.section_info_text_size')) + .lineHeight($r('app.float.section_info_text_line')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .margin({ top: $r('app.float.section_info_text_margin') }) + } + } +} + +@Component +export struct ProductPrice { + public price: string = ''; + public originalPrice: string = ''; + + build() { + Row() { + Text(this.price) + .fontSize($r('app.float.section_price_text_size')) + .lineHeight($r('app.float.section_price_text_line')) + .fontColor($r('app.color.section_text')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + if (this.originalPrice !== '') { + Text(this.originalPrice) + .fontSize($r('app.float.original_price_text_size')) + .lineHeight($r('app.float.original_price_text_line')) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.original_price_color')) + .decoration({ + type: TextDecorationType.LineThrough, + color: $r('app.color.original_price_color') + }) + .margin({ left: $r('app.float.original_price_text_margin')}) + } + } + .margin({ top: $r('app.float.section_price_text_margin') }) + } +} + +@Component +export struct ProductFeature { + public feature: string[] = []; + + build() { + Row() { + ForEach(this.feature, (itemStr: string) => { + Text(itemStr) + .fontSize($r('app.float.section_feature_text_size')) + .lineHeight($r('app.float.section_feature_text_line')) + .fontColor($r('app.color.section_text')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .padding({ + left: $r('app.float.section_feature_padding'), + right: $r('app.float.section_feature_padding') + }) + .margin({ + top: $r('app.float.section_feature_margin_top'), + left: $r('app.float.section_feature_margin_left') + }) + .border({ + width: $r('app.float.section_feature_border_width'), + color: $r('app.color.section_feature_border_color'), + radius: $r('app.float.section_feature_border_radius'), + style: BorderStyle.Solid + }) + }, (item: string, index: number) => index + JSON.stringify(item)) + } + } +} + +@Component +export struct ProductComments { + public comments: string = ''; + + build() { + Text(this.comments) + .fontSize($r('app.float.section_comments_text_size')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.section_comments_text_line')) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .margin({ + top: $r('app.float.section_comments_text_top'), + bottom: $r('app.float.section_comments_text_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/FlashSale.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/FlashSale.ets new file mode 100644 index 0000000000000000000000000000000000000000..75694884f93db4c61f4b266b450e0e6cd0713cda --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/FlashSale.ets @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, Logger, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { SectionProduct, SectionProductsViewModel } from '../viewmodel/SectionProductsViewModel'; +import { HomeButton, ProductFeature, ProductInfo, ProductPrice, ProductTitle, TitleView } from './CommonView'; + +@Component +export struct FlashSale { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + private context: Context = this.getUIContext().getHostContext()! + private flashSaleProductList: SectionProduct[] = new SectionProductsViewModel(this.context).getFlashSaleProductList(); + + build() { + Column() { + TitleView({ titleText: HomeConstants.HOME_TITLES(this.context)[2] }) + + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[0], + md: BreakpointConstants.GRID_ROW_COLUMNS[1], + lg: BreakpointConstants.GRID_ROW_COLUMNS[2] + }, + gutter: { + x: new BreakpointType($r('app.float.flash_grid_gutter_x_sm'), $r('app.float.flash_grid_gutter_x_md'), + $r('app.float.flash_grid_gutter_x_lg')).getValue(this.currentBreakpoint), + y: $r('app.float.flash_grid_gutter_y') + } + }) { + ForEach(this.getCurrentSectionProducts(), (item: SectionProduct) => { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[2], + md: BreakpointConstants.GRID_COLUMN_SPANS[2], + lg: BreakpointConstants.GRID_COLUMN_SPANS[2] + } + }){ + Row() { + Image(item.getProductImg()) + .height(this.getImageHeight(this.currentBreakpoint, this.windowWidth) + CommonConstants.WIDTH_UNIT) + .aspectRatio(1) + + Column() { + ProductTitle({ title: item.getTitle(), isCenter: false }) + ProductInfo({ info: item.getInfo() }) + ProductFeature({ feature: item.getFeature() }) + Blank() + ProductPrice({ price: item.getPrice(), originalPrice: item.getOriginalPrice() }) + HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS(this.context)[1] }) + .margin({ + top: $r('app.float.flash_button_top'), + bottom: $r('app.float.flash_button_bottom'), + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.flash_button_right_lg') : $r('app.float.flash_button_right') + }) + .alignSelf(ItemAlign.End) + } + .alignItems(HorizontalAlign.Start) + .margin({ left: $r('app.float.flash_row_margin') }) + .layoutWeight(1) + .height(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + .height(this.getGridColHeight()) + }, (item: SectionProduct, index: number) => index + JSON.stringify(item)) + } + } + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .backgroundColor(Color.White) + .margin({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.flash_sale_margin_lg') : + $r('app.float.flash_sale_margin'), + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.flash_sale_margin_lg') : + $r('app.float.flash_sale_margin') + }) + } + + getCurrentSectionProducts(): SectionProduct[] { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + return this.flashSaleProductList.slice(0, 2); + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.flashSaleProductList.slice(0, 4); + } else { + return this.flashSaleProductList; + } + } + + getImageHeight(currentBreakpoint: string, windowWidth: number): number { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) + .getValue(this.currentBreakpoint) * 2; + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = result - CommonConstants.LG_SIDEBAR_WIDTH; + } else { + Logger.info(`No need to subtract sidebar width`); + } + + // Calculate the width of a single image based on the number of display counts. + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + result = result * HomeConstants.FLASH_SALE_IMAGE_PERCENT[0]; + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result = (result - HomeConstants.WELFARE_GRID_COL_GUTTERS[1]) / CommonConstants.TWO * + HomeConstants.FLASH_SALE_IMAGE_PERCENT[1]; + } else { + result = (result - HomeConstants.WELFARE_GRID_COL_GUTTERS[3] * 2) / CommonConstants.THREE * + HomeConstants.FLASH_SALE_IMAGE_PERCENT[1]; + } + return result; + } + + getGridColHeight(): string { + if (this.getImageHeight(this.currentBreakpoint, this.windowWidth) <= HomeConstants.FLASH_SALE_INTRO_COL_HEIGHT) { + return HomeConstants.FLASH_SALE_INTRO_COL_HEIGHT + CommonConstants.WIDTH_UNIT; + } + return this.getImageHeight(this.currentBreakpoint, this.windowWidth) + CommonConstants.WIDTH_UNIT; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/Home.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Home.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a88f1314a2e5653c522e628ee748902c72ac200 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Home.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { FooterTab, FooterTabViewModel } from '../viewmodel/FooterTabViewModel'; +import { HomeContent } from './HomeContent'; +import { ClassifyContent } from './ClassifyContent'; +import { ShoppingBagContent } from './ShoppingBagContent'; + +@Component +export struct Home { + @State currentBottomIndex: number = 0; + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! + private tabList: FooterTab[] = new FooterTabViewModel(this.context).getTabList(); + + @Builder + BottomTabBuilder(item: FooterTab, index: number) { + Column() { + Image(index !== this.currentBottomIndex ? item.getIcon() : item.getIconSelected()) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + Text(item.getName()) + .fontSize($r('app.float.tab_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(index === this.currentBottomIndex ? $r('app.color.tab_sel_color') : Color.Black) + .margin({ top: $r('app.float.tab_top_margin') }) + .opacity(index === this.currentBottomIndex ? CommonConstants.TEXT_OPACITY[0] : CommonConstants.TEXT_OPACITY[1]) + } + .padding({ + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : CommonConstants.BOTTOM_RECT_HEIGHT + }) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.side_tab_bar_height') : + CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + } + + build() { + Column() { + Tabs({ barPosition: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : + BarPosition.End }) { + TabContent() { + HomeContent() + } + .tabBar(this.BottomTabBuilder(this.tabList[0], 0)) + + TabContent() { + ClassifyContent() + } + .tabBar(this.BottomTabBuilder(this.tabList[1], 1)) + + TabContent() { + } + .tabBar(this.BottomTabBuilder(this.tabList[2], 2)) + + TabContent() { + ShoppingBagContent() + } + .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) + + TabContent() { + } + .tabBar(this.BottomTabBuilder(this.tabList[4], 4)) + } + // Change the position and size of the tab at the bottom. + .barWidth(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : + CommonConstants.FULL_PERCENT) + .barHeight(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : + ((deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : + CommonConstants.TAB_BAR_HEIGHT + CommonConstants.BOTTOM_RECT_HEIGHT))) + .barBackgroundColor($r('app.color.tab_background_color')) + .barMode(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, + { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) + .vertical(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) + .onChange((index: number) => { + this.currentBottomIndex = index; + }) + .scrollable(false) + } + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeContent.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..1667a356ad82fefbef5222737e3238a3ec26e19e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeContent.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { Categories } from './Categories'; +import { FlashSale } from './FlashSale'; +import { HomeHeader } from './HomeHeader'; +import { RecommendedProductView } from './RecommendedProductView'; +import { Selection } from './Selection'; +import { WelfareView } from './WelfareView'; + +@Component +export struct HomeContent { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private scroller: Scroller = new Scroller(); + + build() { + Column() { + HomeHeader() + + Scroll(this.scroller) { + Column() { + Categories() + + Column() { + RecommendedProductView() + WelfareView() + Selection() + FlashSale() + } + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + } + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .scrollBar(BarState.Off) + } + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeHeader.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..f138e4a08018f3b9f12a916b2607fa9eb23f0654 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/HomeHeader.ets @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct HomeHeader { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[0], + md: BreakpointConstants.GRID_ROW_COLUMNS[4], + lg: BreakpointConstants.GRID_ROW_COLUMNS[2] + } + }) { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[2], + md: BreakpointConstants.GRID_COLUMN_SPANS[6], + lg: BreakpointConstants.GRID_COLUMN_SPANS[3] + } + }) { + this.TopTabBar() + } + .padding({ + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight + }) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : + CommonConstants.TAB_BAR_HEIGHT + this.topRectHeight) + + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[2], + md: BreakpointConstants.GRID_COLUMN_SPANS[2], + lg: BreakpointConstants.GRID_COLUMN_SPANS[2] + } + }) { + this.SearchBar() + } + .padding({ top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === + CommonConstants.DEVICE_TYPES[0] ? 0 : this.topRectHeight }) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === + CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : CommonConstants.TAB_BAR_HEIGHT + + this.topRectHeight) + } + .padding({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) + } + } + + @Builder + TopTabBar() { + List({ space: new BreakpointType(HomeConstants.HOME_HEADER_LIST_SPACES[0], HomeConstants.HOME_HEADER_LIST_SPACES[1], + HomeConstants.HOME_HEADER_LIST_SPACES[2]).getValue(this.currentBreakpoint) }) { + ForEach(HomeConstants.TOP_BAR_TEXTS(this.context), (item: string, index: number) => { + ListItem() { + Text(item) + .fontSize(index === 0 ? $r('app.float.top_bar_text_selected_font') : $r('app.float.top_bar_text_font')) + .lineHeight(index === 0 ? $r('app.float.top_bar_text_selected_line') : $r('app.float.top_bar_text_line')) + .fontWeight(index === 0 ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + .fontColor(index === 0 ? Color.Black : $r('app.color.home_header_text_color')) + } + .layoutWeight(1) + }, (item: string, index: number) => item + index) + } + .scrollBar(BarState.Off) + .alignListItem(ListItemAlign.Center) + .listDirection(Axis.Horizontal) + .padding({ + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.top_text_padding_left_sm') : 0, + right: new BreakpointType($r('app.float.top_text_padding_right_sm'), $r('app.float.top_text_padding_right_md'), + $r('app.float.top_text_padding_right_lg')).getValue(this.currentBreakpoint) + }) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + + @Builder + SearchBar() { + Row() { + Stack({ alignContent: Alignment.Start }) { + TextInput({ placeholder: HomeConstants.SEARCH_PLACEHOLDER(this.context) }) + .placeholderFont({ + size: $r('app.float.search_input_font'), + weight: FontWeight.Normal + }) + .placeholderColor($r('app.color.normal_font_color')) + .height($r('app.float.search_input_height')) + .fontSize($r('app.float.search_input_font')) + .padding({ + left: $r('app.float.search_input_left'), + right: $r('app.float.search_input_right') + }) + .width(CommonConstants.FULL_PERCENT) + .enableKeyboardOnFocus(false) + + // Search image. + Image($r('app.media.ic_public_search')) + .width($r('app.float.search_img_size')) + .height($r('app.float.search_img_size')) + .margin({ left: $r('app.float.search_img_left') }) + } + .alignSelf(ItemAlign.Center) + .layoutWeight(1) + + // Scan image. + Image($r('app.media.ic_public_scan')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.search_img_margin_sm') : $r('app.float.search_img_margin') }) + + // Message image. + Image($r('app.media.ic_public_comments')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.search_img_margin_sm') : $r('app.float.search_img_margin') }) + } + .justifyContent(FlexAlign.Center) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/RecommendedProductView.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/RecommendedProductView.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3d74581ef39bfef6402b32ad716e3524e328a93 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/RecommendedProductView.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, Logger, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { RecommendedProductViewModel, RecommendedProduct } from '../viewmodel/RecommendedProductViewModel'; + +@Component +export struct RecommendedProductView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @State recommendedProducts: RecommendedProduct[] = new RecommendedProductViewModel().getRecommendedProductList(); + + build() { + Swiper() { + ForEach(this.getRecommendedProducts(this.recommendedProducts), (item: RecommendedProduct) => { + Stack() { + Image(item.getImage()) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + + if (item.getIsLive()) { + Image($r('app.media.icon_is_living')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ + top: $r('app.float.section_live_margin'), + right: $r('app.float.section_live_margin') + }) + } + } + .alignContent(Alignment.TopEnd) + .aspectRatio(1) + .width(this.getSwiperWidth(this.currentBreakpoint, this.windowWidth)) + .height(this.getSwiperWidth(this.currentBreakpoint, this.windowWidth)) + }, (item: Resource, index: number) => JSON.stringify(item) + index) + } + .displayCount(new BreakpointType(CommonConstants.TWO, CommonConstants.THREE, CommonConstants.FOUR) + .getValue(this.currentBreakpoint)) + .itemSpace(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD ? + HomeConstants.RECOMMENDED_PRODUCT_ITEM_SPACES[1] : HomeConstants.RECOMMENDED_PRODUCT_ITEM_SPACES[0]) + .margin({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.recommend_swiper_top_sm') : 0, + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD ? + $r('app.float.recommend_swiper_bottom_md') : $r('app.float.recommend_swiper_bottom') + }) + .indicator(false) + } + + getRecommendedProducts(recommendedProducts: RecommendedProduct[]): RecommendedProduct[] { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + return recommendedProducts.slice(0, 2); + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return recommendedProducts.slice(0, 3); + } else { + return recommendedProducts; + } + } + + getSwiperWidth(currentBreakpoint: string, windowWidth: number): string { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) + .getValue(this.currentBreakpoint); + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = result - CommonConstants.LG_SIDEBAR_WIDTH; + } else { + Logger.info(`No need to subtract sidebar width`); + } + // Calculate the width of a single image based on the number of display counts. + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + result = (result - HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1] * 1) / CommonConstants.TWO; + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result = (result - HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[0] * 3) / CommonConstants.FOUR; + } else { + result = (result - HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1] * 5) / CommonConstants.FOUR; + } + // Calculate the height of a single image, title, and content, and calculate the total height of the grid layout. + return result / 1 * CommonConstants.TWO + CommonConstants.WIDTH_UNIT; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/Selection.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Selection.ets new file mode 100644 index 0000000000000000000000000000000000000000..353d037455edf6b4f077ff31ef80cda6e0ffc243 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/Selection.ets @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, Logger, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { SectionProduct, SectionProductsViewModel } from '../viewmodel/SectionProductsViewModel'; +import { ProductComments, ProductFeature, ProductInfo, ProductPrice, ProductTitle, TitleView } from './CommonView'; + +@Component +export struct Selection { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + private context: Context = this.getUIContext().getHostContext()! + private sectionProducts: SectionProduct[] = new SectionProductsViewModel(this.context).getSectionProductList(); + + build() { + Column() { + TitleView({ titleText: HomeConstants.HOME_TITLES(this.context)[1] }) + + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[0], + md: BreakpointConstants.GRID_ROW_COLUMNS[2], + lg: BreakpointConstants.GRID_ROW_COLUMNS[3] + }, + gutter: new BreakpointType($r('app.float.section_gutter_sm'), $r('app.float.section_gutter_md'), + $r('app.float.section_gutter_lg')).getValue(this.currentBreakpoint) + }) { + ForEach(this.getCurrentSectionProducts(), (item: SectionProduct, index: number) => { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[0], + md: BreakpointConstants.GRID_COLUMN_SPANS[2], + lg: BreakpointConstants.GRID_COLUMN_SPANS[1] + } + }) { + Column() { + Stack() { + Image(item.getProductImg()) + .objectFit(ImageFit.Contain) + .aspectRatio(HomeConstants.SELECTION_IMG_ASPECT_RATIO) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + + if (index === 1) { + Image($r('app.media.icon_is_living')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ + top: $r('app.float.section_live_margin'), + right: $r('app.float.section_live_margin') + }) + } + } + .alignContent(Alignment.TopEnd) + .height(this.getStackHeight(this.currentBreakpoint, this.windowWidth)) + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.section_image_margin_sm') : $r('app.float.section_image_margin') }) + + ProductTitle({ title: item.getTitle() }) + ProductInfo({ info: item.getInfo() }) + ProductFeature({ feature: item.getFeature() }) + ProductPrice({ price: item.getPrice() }) + ProductComments({ comments: item.getComments() }) + } + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + }, (item: SectionProduct, index: number) => index + JSON.stringify(item)) + } + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .backgroundColor(Color.White) + .margin({ top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD ? $r('app.float.section_margin_md') : + $r('app.float.section_margin')}) + } + + getCurrentSectionProducts(): SectionProduct[] { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + return this.sectionProducts.slice(0, 2); + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.sectionProducts.slice(0, 3); + } else { + return this.sectionProducts; + } + } + + getStackHeight(currentBreakpoint: string, windowWidth: number): string { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) + .getValue(this.currentBreakpoint) * 2; + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = result - CommonConstants.LG_SIDEBAR_WIDTH; + } else { + Logger.info(`No need to subtract sidebar width`); + } + + // Calculate the width of a single image based on the number of display counts. + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + result = (result - HomeConstants.WELFARE_GRID_COL_GUTTERS[0] * 1) / CommonConstants.TWO; + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result = (result - HomeConstants.WELFARE_GRID_COL_GUTTERS[0] * 2) / CommonConstants.THREE; + } else { + result = (result - HomeConstants.WELFARE_GRID_COL_GUTTERS[1] * 4) / CommonConstants.FIVE; + } + // Calculate the height of a single image. + return result / HomeConstants.SELECTION_IMG_ASPECT_RATIO + CommonConstants.WIDTH_UNIT; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagContent.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..e553e1546ed81073e15626540fbd20db899ef053 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagContent.ets @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { ShoppingCardFoot } from './ShoppingCardFoot'; +import { ShoppingBagDiscounts } from './ShoppingBagDiscounts'; +import { ShoppingBagListViewModel, ShoppingBagProduct } from '../viewmodel/ShoppingBagListViewModel'; +import { ShoppingCardItem } from './ShoppingCardItem'; +import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; + +@Component +export struct ShoppingBagContent { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + + build() { + Row() { + ShoppingBagView() + ShoppingBagDiscounts() + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + } +} + +@Component +struct ShoppingBagView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Column() { + Row() { + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[0]) + .font({ + size: $r('app.float.bag_title_font'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + Blank() + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[1]) + .font({ + size: $r('app.float.bag_name_font') + }) + .opacity(CommonConstants.TEXT_OPACITY[2]) + } + .height($r('app.float.bag_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + + ShoppingBagCard() + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .margin({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? $r('app.float.bag_col_margin') : + this.topRectHeight }) + + ShoppingCardFoot() + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.None : Visibility.Visible) + } + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .layoutWeight(ShoppingBagConstants.SHOPPING_BAG_LAYOUT_WEIGHTS[0]) + .height(CommonConstants.FULL_PERCENT) + .border({ + width: { right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 1 : 0 }, + color: ResourceUtil.getCommonBorderColor()[1] + }) + } +} + +@Component +export struct DetailShoppingBagView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + @Consume('pageInfos') pageInfos: NavPathStack; + public isMoreDetail: boolean = false; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Column() { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ right: $r('app.float.bag_back_margin') }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM && this.isMoreDetail ? + Visibility.Visible : Visibility.None) + .onClick(() => { + if (this.pageInfos !== undefined) { + this.pageInfos.pop(); + } + }) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[0]) + .font({ + size: $r('app.float.bag_title_font'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + Blank() + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[1]) + .font({ size: $r('app.float.bag_name_font') }) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Image($r('app.media.icon_close')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ left: $r('app.float.bag_close_margin') }) + .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? Visibility.Visible : + Visibility.None) + .onClick(() => { + if (this.pageInfos !== undefined) { + this.pageInfos.pop(); + } + }) + } + .height($r('app.float.bag_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + + ShoppingBagCard() + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .margin({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? $r('app.float.bag_col_margin') : + this.topRectHeight }) + + ShoppingCardFoot() + .margin({ bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0] ? + CommonConstants.BOTTOM_RECT_HEIGHT : 0 }) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG && !this.isMoreDetail ? + Visibility.None : Visibility.Visible) + } + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) + }) + .layoutWeight(ShoppingBagConstants.SHOPPING_BAG_LAYOUT_WEIGHTS[0]) + .height(CommonConstants.FULL_PERCENT) + .border({ + width: { right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 1 : 0 }, + color: ResourceUtil.getCommonBorderColor()[1] + }) + } +} + +@Component +export struct ShoppingBagCard { + private context: Context = this.getUIContext().getHostContext()! + private ShoppingBagList: ShoppingBagProduct[] = new ShoppingBagListViewModel(this.context).getShoppingBagItemData(); + + build() { + Scroll() { + Column() { + Row() { + CheckboxGroup({ group: 'shoppingCardHuaWei' }) + .selectedColor($r('app.color.classify_indicator_selected_color')) + .width($r('app.float.check_box_size')) + .height($r('app.float.check_box_size')) + .margin({ right: $r('app.float.check_box_group_margin') }) + .border({ color: ResourceUtil.getCommonBorderColor()[2] }) + + Image($r('app.media.shopping_card_logo')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .margin({ right: $r('app.float.bag_seller_logo_margin') }) + .border({ + radius: ResourceUtil.getCommonBorderRadius()[4], + width: $r('app.float.bag_seller_logo_border_width'), + color: ResourceUtil.getCommonBorderColor()[3] + }) + + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[2]) + .font({ + size: $r('app.float.bag_name_font'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + .layoutWeight(1) + } + .height($r('app.float.bag_card_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + + List() { + ForEach(this.ShoppingBagList, (item: ShoppingBagProduct) => { + ListItem() { + Row() { + Column() { + Checkbox({ group: 'shoppingCardHuaWei' }) + .selectedColor($r('app.color.classify_indicator_selected_color')) + .width($r('app.float.check_box_size')) + .height($r('app.float.check_box_size')) + .margin({ + right: $r('app.float.bag_card_check_box_margin'), + left: 0 + }) + .border({ + color: ResourceUtil.getCommonBorderColor()[2] + }) + .shape(CheckBoxShape.ROUNDED_SQUARE) + } + .width($r('app.float.bag_card_check_col_width')) + .padding({ top: $r('app.float.bag_card_check_col_padding') }) + .justifyContent(FlexAlign.Start) + + ShoppingCardItem({ + shoppingBagProductItem: item, + titleEllipsis: false + }) + .layoutWeight(1) + } + .width(CommonConstants.FULL_PERCENT) + .padding({ + top: $r('app.float.bag_card_row_padding'), + bottom: $r('app.float.bag_card_row_padding') + }) + } + }) + } + .scrollBar(BarState.Off) + } + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + .borderRadius(ResourceUtil.getCommonBorderRadius()[7]) + .padding($r('app.float.bag_card_col_padding')) + .margin({ bottom: CommonConstants.BOTTOM_RECT_HEIGHT }) + } + .scrollBar(BarState.Off) + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagDiscounts.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagDiscounts.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b87e3cf4549b3987883927fedbf501fd331a7a0 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingBagDiscounts.ets @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, ResourceUtil, CommonConstants } from '@ohos/commons'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { ShoppingCardItem } from './ShoppingCardItem'; +import { ShoppingBagListViewModel, ShoppingBagProduct, PreferenceDetails, PreferenceDetailsList } + from '../viewmodel/ShoppingBagListViewModel'; +import { ShoppingCardFoot } from './ShoppingCardFoot'; +import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; + +@Component +export struct ShoppingBagDiscounts { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! + private ShoppingBagList: ShoppingBagProduct[]= new ShoppingBagListViewModel(this.context).getShoppingBagItemData(); + private PreferenceDetailsList: PreferenceDetails[]= new PreferenceDetailsList(this.context).getPreferenceDetailsList(); + private ShoppingBagProductItem: ShoppingBagProduct = this.ShoppingBagList[2]; + + build() { + Column() { + Scroll() { + Column() { + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[0]) + .fontSize($r('app.float.bag_discount_font_1')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .lineHeight($r('app.float.bag_discount_line_1')) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[1]) + .fontSize($r('app.float.bag_discount_font_2')) + .lineHeight($r('app.float.bag_discount_line_2')) + .fontWeight(FontWeight.Normal) + .padding({ + top: $r('app.float.bag_discount_title_padding_top'), + bottom: $r('app.float.bag_discount_title_padding_bottom') + }) + + Column() { + ShoppingCardItem({ + shoppingBagProductItem: this.ShoppingBagProductItem, + titleEllipsis: true + }) + Row() { + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[2]) + .fontSize($r('app.float.bag_discount_font_3')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[3]) + .fontSize($r('app.float.bag_discount_font_2')) + .fontWeight(FontWeight.Normal) + } + .height($r('app.float.bag_discount_row_height')) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + + Row() { + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[4]) + .fontSize($r('app.float.bag_discount_font_3')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[5]) + .fontSize($r('app.float.bag_discount_font_2')) + .fontWeight(FontWeight.Normal) + Image($r('app.media.ic_public_more_list')) + .height(ResourceUtil.getCommonImgSize()[0]) + .width(ResourceUtil.getCommonImgSize()[0]) + } + .justifyContent(FlexAlign.Center) + .height($r('app.float.bag_discount_row_height')) + .width(CommonConstants.FULL_PERCENT) + } + .backgroundColor(Color.White) + .padding($r('app.float.bag_discount_padding')) + .border({ radius: ResourceUtil.getCommonBorderRadius()[6] }) + .margin({ bottom: $r('app.float.bag_discount_margin') }) + + Column() { + ForEach(this.PreferenceDetailsList, (item: PreferenceDetails) => { + Row() { + Text(item.getTitle()) + .fontSize($r('app.float.bag_discount_font_3')) + .fontWeight(FontWeight.Normal) + Blank() + Text(item.getPrice()) + .fontSize($r('app.float.bag_discount_font_2')) + .fontColor('#CF0A2C') + } + .justifyContent(FlexAlign.Center) + .height($r('app.float.bag_discount_row_height')) + .width(CommonConstants.FULL_PERCENT) + }, (item: PreferenceDetails, index: number) => JSON.stringify(item) + index) + } + .backgroundColor(Color.White) + .padding($r('app.float.bag_discount_padding')) + .border({ radius: ResourceUtil.getCommonBorderRadius()[6] }) + } + .width(CommonConstants.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + .padding({ + left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? + $r('app.float.bag_discount_col_padding_bottom') : this.topRectHeight, + }) + + } + .width(CommonConstants.FULL_PERCENT) + .scrollBarWidth(0) + .layoutWeight(1) + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) + + ShoppingCardFoot({ isMoreDetail: true }) + .margin({ bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0] ? + CommonConstants.BOTTOM_RECT_HEIGHT : 0 }) + } + .backgroundColor($r('app.color.bag_discount_background')) + .layoutWeight(ShoppingBagConstants.SHOPPING_BAG_LAYOUT_WEIGHTS[1]) + .height(CommonConstants.FULL_PERCENT) + .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardFoot.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardFoot.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c9fb1a2dbacef4290a2dc031236661e1f37d367 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardFoot.ets @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; + +@Component +export struct ShoppingCardFoot { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + public isMoreDetail: boolean = false; + private context: Context = this.getUIContext().getHostContext()! + + build() { + Row(){ + Row(){ + Checkbox() + .selectedColor($r('app.color.classify_indicator_selected_color')) + .width($r('app.float.check_box_size')) + .height($r('app.float.check_box_size')) + .margin({ + right: $r('app.float.shop_card_check_margin'), + left: 0 + }) + .border({ + color: ResourceUtil.getCommonBorderColor()[2] + }) + .shape(CheckBoxShape.ROUNDED_SQUARE) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[0]) + .fontSize($r('app.float.shop_card_font_1')) + .lineHeight($r('app.float.shop_card_line_1')) + .fontWeight(FontWeight.Normal) + } + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + + Blank() + + Row(){ + Column(){ + Row(){ + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[1]) + .fontSize($r('app.float.shop_card_font_1')) + .lineHeight($r('app.float.shop_card_line_1')) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[2]) + .fontSize($r('app.float.shop_card_font_1')) + .lineHeight($r('app.float.shop_card_line_2')) + .fontColor($r('app.color.shop_card_font_color')) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[3]) + .fontSize($r('app.float.shop_card_font_2')) + .lineHeight($r('app.float.shop_card_line_3')) + .fontColor($r('app.color.shop_card_font_color')) + } + Row(){ + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[4]) + .fontSize($r('app.float.shop_card_font_3')) + .lineHeight($r('app.float.shop_card_line_4')) + .fontWeight(FontWeight.Normal) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .margin({ + right: $r('app.float.arrow_up_margin') + }) + Image($r('app.media.ic_public_arrow_up')) + .width($r('app.float.arrow_up_width')) + .height($r('app.float.arrow_up_height')) + .opacity(CommonConstants.TEXT_OPACITY[1]) + } + } + + Button(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[5], + { type: ButtonType.Capsule, stateEffect: true }) + .labelStyle({ + font:{ + size:$r('app.float.shop_card_font_2') + } + }) + .backgroundColor($r('app.color.shop_card_foot_button')) + .height($r('app.float.foot_button_height')) + .width($r('app.float.foot_button_width')) + .margin({ + left: $r('app.float.foot_button_margin') + }) + } + .height(CommonConstants.FULL_PERCENT) + .alignItems(VerticalAlign.Center) + } + .justifyContent(FlexAlign.Start) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.foot_height')) + .padding({ + left: this.isMoreDetail ? $r('app.float.foot_padding_more') : 0, + right: this.isMoreDetail ? $r('app.float.foot_padding_more') : 0 + }) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardItem.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..820930fb7c6eb63424d1cfee6aaaa9ebd3d8505b --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/ShoppingCardItem.ets @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants, ResourceUtil } from '@ohos/commons'; +import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; +import { ShoppingBagListViewModel, ShoppingBagProduct } from '../viewmodel/ShoppingBagListViewModel'; + +@Component +export struct ShoppingCardItem { + private context: Context = this.getUIContext().getHostContext()! + public shoppingBagProductItem: ShoppingBagProduct = new ShoppingBagListViewModel(this.context).getShoppingBagItemData()[2]; + public titleEllipsis?: boolean; + + build() { + Row(){ + Column() { + Row() { + Image(this.shoppingBagProductItem.getImage()) + .width(ResourceUtil.getCommonImgSize()[7]) + .height(ResourceUtil.getCommonImgSize()[7]) + .border({ + radius: ResourceUtil.getCommonBorderRadius()[3] + }) + + Column() { + Row() { + Text(this.shoppingBagProductItem.getName()) + .fontSize($r('app.float.card_item_font_1')) + .fontWeight(FontWeight.Normal) + .textOverflow({ + overflow:TextOverflow.Ellipsis + }) + .maxLines(this.titleEllipsis === true ? 1 : 2) + } + .margin({ + bottom: $r('app.float.card_item_name_margin') + }) + + Row() { + Text(this.shoppingBagProductItem.getType()) + .textOverflow({ overflow:TextOverflow.Ellipsis }) + .maxLines(1) + .fontSize($r('app.float.card_item_font_6')) + .fontColor($r('app.color.shop_card_type_font')) + .margin({ + right: $r('app.float.card_item_type_margin') + }) + Image($r('app.media.ic_public_arrow_down')) + .width(ResourceUtil.getCommonImgSize()[8]) + .height(ResourceUtil.getCommonImgSize()[8]) + } + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[2]) + .border({ radius: ResourceUtil.getCommonBorderRadius()[9] }) + .padding({ + top: $r('app.float.card_type_padding_row_top'), + bottom: $r('app.float.card_type_padding_row_top'), + left: $r('app.float.card_type_padding_row_left'), + right: $r('app.float.card_type_padding_row_right') + }) + .margin({ + bottom: $r('app.float.card_type_margin_row_bottom') + }) + + Row() { + ForEach(this.shoppingBagProductItem.getPreferentialList(), (item: string)=>{ + Text(item) + .border({ + color: $r('app.color.shop_card_font_color'), + radius: ResourceUtil.getCommonBorderRadius()[1], + width: 1 + }) + .fontSize($r('app.float.card_item_font_2')) + .fontColor($r('app.color.shop_card_font_color')) + .padding({ + top: $r('app.float.card_preferential_padding_top'), + bottom: $r('app.float.card_preferential_padding_top'), + left: $r('app.float.card_preferential_padding_left'), + right: $r('app.float.card_preferential_padding_left') + }) + .margin({ right: $r('app.float.card_preferential_margin') }) + }, (item: string, index: number) => item + index) + } + .margin({ bottom: $r('app.float.card_preferential_row_margin') }) + + Flex({ + direction: FlexDirection.Row, + alignItems: ItemAlign.Center, + wrap:FlexWrap.Wrap + }) { + Row() { + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[0]) + .font({ + size: $r('app.float.card_item_font_3'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + Text(JSON.stringify(this.shoppingBagProductItem.getPrice())) + .font({ + size: $r('app.float.card_item_font_4'), + weight: CommonConstants.FONT_WEIGHT_500 + }) + .margin({ + right: $r('app.float.card_price_margin') + }) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[0] + + JSON.stringify(this.shoppingBagProductItem.getOriginalPrice())) + .font({ + size: $r('app.float.card_item_font_5'), + }) + .fontColor($r('app.color.shop_card_type_font')) + .decoration({ + type: TextDecorationType.LineThrough, + color: $r('app.color.shop_card_type_font') + }) + .margin({ + right: $r('app.float.card_price_more_margin') + }) + .visibility(this.shoppingBagProductItem.getOriginalPrice() === -1 ? Visibility.None : + Visibility.Visible) + } + Blank() + Row() { + this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[1]) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[2]) + .fontSize($r('app.float.card_number_font')) + .width($r('app.float.card_number_width')) + .margin({ + left: $r('app.float.card_number_margin'), + right: $r('app.float.card_number_margin') + }) + .textAlign(TextAlign.Center) + this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[3]) + } + } + .width(CommonConstants.FULL_PERCENT) + } + .padding({ + left: $r('app.float.card_item_col_padding'), + bottom: $r('app.float.card_item_col_padding') + }) + .layoutWeight(1) + .alignItems(HorizontalAlign.Start) + } + + Column() { + Row() { + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[4]) + .fontSize($r('app.float.card_item_font_3')) + .width($r('app.float.card_gift_width')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text(this.shoppingBagProductItem.getPresent()) + .fontSize($r('app.float.card_item_font_3')) + .fontColor($r('app.color.card_gift_font')) + .layoutWeight(1) + .textOverflow({ + overflow:TextOverflow.Ellipsis + }) + .maxLines(1) + Blank() + Image(ResourceUtil.getArrowRight()) + .width(ResourceUtil.getCommonImgSize()[9]) + .height(ResourceUtil.getCommonImgSize()[9]) + } + .width(CommonConstants.FULL_PERCENT) + .margin({ + top: $r('app.float.card_gift_row_margin_top'), + bottom: $r('app.float.card_gift_row_margin_bottom') + }) + + Row() { + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[5]) + .fontSize($r('app.float.card_item_font_3')) + .width($r('app.float.card_gift_width')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text(this.shoppingBagProductItem.getService()) + .fontSize($r('app.float.card_item_font_3')) + .backgroundColor(ResourceUtil.getCommonBackgroundColor()[2]) + .border({ radius: ResourceUtil.getCommonBorderRadius()[1] }) + .padding({ + left: $r('app.float.card_service_padding_left'), + right: $r('app.float.card_service_padding_left'), + top: $r('app.float.card_service_padding_top'), + bottom: $r('app.float.card_service_padding_top') + }) + Blank() + Image(ResourceUtil.getArrowRight()) + .width(ResourceUtil.getCommonImgSize()[9]) + .height(ResourceUtil.getCommonImgSize()[9]) + } + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: $r('app.float.card_gift_row_padding') + }) + } + .alignItems(HorizontalAlign.Start) + .layoutWeight(1) + } + .width(CommonConstants.FULL_PERCENT) + } + + @Builder + AddButton(buttonText: string) { + Text(buttonText) + .width($r('app.float.add_button_size')) + .height($r('app.float.add_button_size')) + .border({ + radius: ResourceUtil.getCommonBorderRadius()[4], + width: $r('app.float.add_button_border_width'), + color: $r('app.color.add_button_border') + }) + .fontColor($r('app.color.add_button_border')) + .textAlign(TextAlign.Center) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/view/WelfareView.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/view/WelfareView.ets new file mode 100644 index 0000000000000000000000000000000000000000..91b03b3c2bac802dec7042e5cd872cc4e6aadde6 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/view/WelfareView.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants, ResourceUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { IconInfo, IconInfoViewModel } from '../viewmodel/IconInfoViewModel'; +import { HomeButton } from './CommonView'; + +@Component +export struct WelfareView { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private context: Context = this.getUIContext().getHostContext()! + private welfareList: IconInfo[] = new IconInfoViewModel(this.context).getWelfareList(); + + build() { + Column() { + Row() { + Text(HomeConstants.HOME_TITLES(this.context)[0]) + .fontSize($r('app.float.title_font')) + .lineHeight($r('app.float.title_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + Blank() + + HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS(this.context)[0] }) + } + .justifyContent(FlexAlign.Start) + .height($r('app.float.title_height')) + .width(CommonConstants.FULL_PERCENT) + + Row() { + ForEach(this.getCurrentWelfareList(), (item: IconInfo) => { + Column() { + Image(item.getIcon()) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.welfare_image_size_sm') : $r('app.float.welfare_image_size')) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.welfare_image_size_sm') : $r('app.float.welfare_image_size')) + Text(HomeConstants.TIP_TEXTS(this.context)[0]) + .fontSize($r('app.float.welfare_tip_font')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.welfare_tip_line')) + .width($r('app.float.welfare_tip_width')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[5]) + .backgroundColor($r('app.color.welfare_tip_background')) + .textAlign(TextAlign.Center) + Text(item.getInfo()) + .fontSize($r('app.float.welfare_info_font')) + .lineHeight($r('app.float.welfare_info_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .margin({ top: $r('app.float.welfare_info_margin') }) + } + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + .backgroundColor(Color.White) + }, (item: IconInfo, index: number) => index + JSON.stringify(item)) + } + .height(new BreakpointType($r('app.float.welfare_row_height_sm'), $r('app.float.welfare_row_height_md'), + $r('app.float.welfare_row_height_lg')).getValue(this.currentBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: new BreakpointType($r('app.float.welfare_row_padding_sm'), $r('app.float.welfare_row_padding_md'), + $r('app.float.welfare_row_padding_lg')).getValue(this.currentBreakpoint), + right: new BreakpointType($r('app.float.welfare_row_padding_sm'), $r('app.float.welfare_row_padding_md'), + $r('app.float.welfare_row_padding_lg')).getValue(this.currentBreakpoint) + }) + } + .height(new BreakpointType($r('app.float.welfare_col_height_sm'), $r('app.float.welfare_col_height_md'), + $r('app.float.welfare_col_height_lg')).getValue(this.currentBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: $r('app.float.welfare_col_padding'), + right: $r('app.float.welfare_col_padding') + }) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .linearGradient({ + direction: GradientDirection.Right, + repeating: false, + colors: [[HomeConstants.GRADIENT_COLORS[0], 0.0], [HomeConstants.GRADIENT_COLORS[1], 1.0]] + }) + } + + getCurrentWelfareList(): IconInfo[] { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + return this.welfareList.slice(0, 3); + } else if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.welfareList.slice(0, 6); + } else { + return this.welfareList; + } + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..306952fd298ee98931b70b5484d2c07a9baba04e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../constants/HomeConstants'; + +export class FooterTabViewModel { + private tabList: FooterTab[] = []; + + constructor(context: Context) { + HomeConstants.FOOTER_TOPIC_LIST(context).forEach((item: string, index: number) => { + this.tabList.push(new FooterTab(item, HomeConstants.FOOTER_TOPIC_ICONS[index], + HomeConstants.FOOTER_TOPIC_ICONS_SELECTED[index])); + }); + } + + getTabList(): FooterTab[] { + return this.tabList; + } +} + +export class FooterTab { + /** + * Name of the tab. + */ + private name: string; + + /** + * Icon of the tab. + */ + private icon: Resource; + + /** + * Icon selected. + */ + private iconSelected: Resource; + + constructor(name: string, icon: Resource, iconSelected: Resource) { + this.name = name; + this.icon = icon; + this.iconSelected = iconSelected; + } + + getName(): string { + return this.name; + } + + getIcon(): Resource { + return this.icon; + } + + getIconSelected(): Resource { + return this.iconSelected; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..8896e74fcbb883621eceafebe44281df870d3622 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../constants/HomeConstants'; + +export class IconInfoViewModel { + private categoryList: IconInfo[] = []; + private welfareList: IconInfo[] = []; + + constructor(context: Context) { + HomeConstants.GOOD_CATEGORIES(context).forEach((item: string, index: number) => { + this.categoryList.push(new IconInfo(item, HomeConstants.GOOD_CATEGORY_IMG[index])); + }); + HomeConstants.WELFARE_PRODUCTS.forEach((item: string, index: number) => { + this.welfareList.push(new IconInfo(this.makeUpPrice(item, context), HomeConstants.WELFARE_PRODUCT_IMG[index])); + }); + } + + getCategoryList(): IconInfo[] { + return this.categoryList; + } + + makeUpPrice(price: string, context: Context): string { + return HomeConstants.PRICE_UNIT(context)[0] + price + HomeConstants.PRICE_UNIT(context)[1]; + } + + getWelfareList(): IconInfo[] { + return this.welfareList; + } +} + +export class IconInfo { + /** + * Info of the icon. + */ + private info: string; + + /** + * Icon image. + */ + private icon: Resource; + + + constructor(info: string, icon: Resource) { + this.info = info; + this.icon = icon; + } + + getInfo(): string { + return this.info; + } + + getIcon(): Resource { + return this.icon; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/RecommendedProductViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/RecommendedProductViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2bc5aa134a6a585d0258a4392c1e6f9c8c8c980 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/RecommendedProductViewModel.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../constants/HomeConstants'; + +export class RecommendedProductViewModel { + private recommendedProductList: RecommendedProduct[] = []; + + constructor() { + HomeConstants.RECOMMENDED_PRODUCTS.forEach((item: Resource, index: number) => { + this.recommendedProductList.push(new RecommendedProduct(item, HomeConstants.RECOMMENDED_PRODUCT_LIVING[index])); + }); + } + + getRecommendedProductList(): RecommendedProduct[] { + return this.recommendedProductList; + } +} + +export class RecommendedProduct { + /** + * Image of the product. + */ + private image: Resource; + + /** + * Whether it is live. + */ + private isLive: boolean; + + + constructor(image: Resource, isLive: boolean) { + this.image = image; + this.isLive = isLive; + } + + getImage(): Resource { + return this.image; + } + + getIsLive(): Boolean { + return this.isLive; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..828eefac43c933b347c4486fe9f79fe49f182d18 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../constants/HomeConstants'; + +export class SectionProductsViewModel { + private sectionProductList: SectionProduct[] = []; + private flashSaleProductList: SectionProduct[] = []; + + constructor(context: Context) { + HomeConstants.SECTION_PRODUCT_IMAGES.forEach((item: Resource, index: number) => { + this.sectionProductList.push(new SectionProduct(item, HomeConstants.SECTION_PRODUCTS_TITLES(context)[index], + HomeConstants.SECTION_PRODUCTS_PRICES[index], HomeConstants.SECTION_PRODUCTS_FEATURES(context)[index], + HomeConstants.SECTION_PRODUCTS_COMMENTS(context), HomeConstants.SECTION_PRODUCTS_INFO(context)[index])); + }); + HomeConstants.FLASH_SALE_PRODUCT_IMAGES.forEach((item: Resource, index: number) => { + this.flashSaleProductList.push(new SectionProduct(item, HomeConstants.FLASH_SALE_PRODUCT_TITLES(context)[index], + HomeConstants.FLASH_SALE_PRODUCT_PRICES[index], + HomeConstants.FLASH_SALE_PRODUCT_FEATURES(context)[index], '', + HomeConstants.FLASH_SALE_PRODUCT_INFO(context)[index], + HomeConstants.FLASH_SALE_PRODUCT_ORIGINAL_PRICES[index])); + }); + } + + getSectionProductList(): SectionProduct[] { + return this.sectionProductList; + } + + getFlashSaleProductList(): SectionProduct[] { + return this.flashSaleProductList; + } +} + +export class SectionProduct { + private productImg: Resource; + private title: string[]; + private price: string; + private feature: string[]; + private comments: string; + private info: string; + private originalPrice?: string; + + constructor(productImg: Resource, title: string[], price: string, feature: string[], comments: string, info: string, + originalPrice?: string) { + this.productImg = productImg; + this.title = title; + this.price = price; + this.feature = feature; + this.comments = comments; + this.info = info; + if (originalPrice !== undefined) { + this.originalPrice = originalPrice; + } + } + + getProductImg(): Resource { + return this.productImg; + } + + getTitle(): string[] { + return this.title; + } + + getPrice(): string { + return this.price; + } + + getFeature(): string[] { + return this.feature; + } + + getComments(): string { + return this.comments; + } + + getInfo(): string { + return this.info; + } + + getOriginalPrice(): string | undefined { + return this.originalPrice; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShopListViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShopListViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba89328ece7f632b977fc801e239ad7cd519ae50 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShopListViewModel.ets @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ClassifyConstants } from '../constants/ClassifyConstants'; + +export class ShopListViewModel { + private shopList: Array = []; + + constructor(context: Context) { + ClassifyConstants.SHOP_MATRIX.forEach((item: Array, index: number) =>{ + let shopItemList: Array = []; + item.forEach((item: string, itemIndex: number) => { + shopItemList.push(new ShopItem(item,ClassifyConstants.SHOP_MATRIX_IMAGE[index][itemIndex])); + }) + this.shopList.push(new ShopListItem(ClassifyConstants.SHOP_TITLE_LIST(context)[index], shopItemList)); + }) + } + + getShopList(): Array { + return this.shopList; + } +} + +export class ShopItem { + /** + * Name of the tab. + */ + private name: string; + + /** + * Icon of the tab. + */ + private image: Resource; + + constructor(name: string, image: Resource) { + this.name = name; + this.image = image; + } + + getName(): string { + return this.name; + } + + getImage(): Resource { + return this.image; + } +} + +export class ShopListItem { + /** + * Name of the ShopList. + */ + private name: string; + + /** + * List of the ShopList. + */ + private ShopList: Array; + + constructor(name: string, ShopList: Array) { + this.name = name; + this.ShopList = ShopList; + } + + getName(): string { + return this.name; + } + + getItem(): Array { + return this.ShopList; + } +} + +export class BannerList { + private bannerList: Array = []; + + constructor() { + ClassifyConstants.BANNER_IMAGE.forEach((item: Resource)=>{ + this.bannerList.push(item) + }) + } + + getBannerList(): Array { + return this.bannerList; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..50c5cb69a682f4621c90211d7cb1bf187efb6e9e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; + +export class ShoppingBagListViewModel { + private ShoppingBagList: ShoppingBagProduct[] = []; + + constructor(context: Context) { + ShoppingBagConstants.PRODUCT_NAME_LIST(context).forEach((item: string, index: number) => { + this.ShoppingBagList.push( + new ShoppingBagProduct(item, ShoppingBagConstants.PRODUCT_IMAGE_LIST[index], + ShoppingBagConstants.PRODUCT_TYPE_LIST(context)[index], + ShoppingBagConstants.PRODUCT_PREFERENTIALList_LIST(context)[index], + ShoppingBagConstants.PRODUCT_PRICE_LIST[index], + ShoppingBagConstants.PRODUCT_ORIGINAL_PRICE_LIST[index], + ShoppingBagConstants.PRODUCT_PRESENT_LIST(context)[index], + ShoppingBagConstants.PRODUCT_SERVICE_LIST(context)[index])); + }) + } + + getShoppingBagItemData(): ShoppingBagProduct[] { + return this.ShoppingBagList; + } +} + +export class ShoppingBagProduct { + private name: string; + private image: Resource; + private type: string; + private preferentialList: Array; + private price: number; + private originalPrice: number; + private present:string; + private service:string; + + constructor(name: string, image: Resource, type: string, preferentialList: Array, price: number, + originalPrice: number, present:string, service:string) { + this.name = name; + this.image = image; + this.type = type; + this.preferentialList = preferentialList; + this.price = price; + this.originalPrice = originalPrice; + this.present = present; + this.service = service; + } + + getName():string{ + return this.name; + } + + getImage(): Resource{ + return this.image; + } + + getType():string{ + return this.type; + } + + getPreferentialList():Array{ + return this.preferentialList; + } + + getPrice():number{ + return this.price; + } + + getOriginalPrice():number{ + return this.originalPrice; + } + + getPresent():string{ + return this.present; + } + + getService():string{ + return this.service; + } +} + +export class PreferenceDetailsList { + private preferenceDetailsList: PreferenceDetails[] = []; + + constructor(context: Context) { + ShoppingBagConstants.PREFERENCE_DETAILS_TITLE(context).forEach((item, index) => { + this.preferenceDetailsList.push(new PreferenceDetails(item, ShoppingBagConstants.PREFERENCE_DETAILS_PRICE[index])); + }) + } + + getPreferenceDetailsList():PreferenceDetails[]{ + return this.preferenceDetailsList; + } +} + +export class PreferenceDetails { + private title: string; + private price:string; + + constructor(title:string, price:string) { + this.title = title; + this.price = price; + } + + getTitle():string{ + return this.title; + } + + getPrice():string{ + return this.price; + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/module.json5 b/MultiShoppingPriceComparison/features/home/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a911a60e0b36d765f8ba54364fc1d7df4089603b --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/module.json5 @@ -0,0 +1,12 @@ +{ + "module": { + "name": "home", + "type": "har", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "2in1", + "tablet" + ] + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/color.json b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..c164767567460f5680b3670c02586b43727f5fcf --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/color.json @@ -0,0 +1,116 @@ +{ + "color": [ + { + "name": "tab_sel_color", + "value": "#D0092D" + }, + { + "name": "tab_background_color", + "value": "#F1F3F5" + }, + { + "name": "normal_font_color", + "value": "#182431" + }, + { + "name": "welfare_tip_background", + "value": "#0D000000" + }, + { + "name": "button_color", + "value": "#E64566" + }, + { + "name": "home_background", + "value": "#F1F3F5" + }, + { + "name": "section_feature_border_color", + "value": "#66D0092D" + }, + { + "name": "section_text", + "value": "#D0092D" + }, + { + "name": "section_tip_background", + "value": "#EA1559" + }, + { + "name": "original_price_color", + "value": "#66000000" + }, + { + "name": "home_header_text_color", + "value": "#99000000" + }, + { + "name": "classify_indicator_color", + "value": "#1A000000" + }, + { + "name": "classify_indicator_selected_color", + "value": "#CF0A2C" + }, + { + "name": "classify_navigation_font_color", + "value": "#99000000" + }, + { + "name": "classify_navigation_selected_font_color", + "value": "#CF0A2C" + }, + { + "name": "classify_navigation_divider_color", + "value": "#CF0A2C" + }, + { + "name": "classify_navigation_content_color_sm", + "value": "#F1F3F5" + }, + { + "name": "classify_navigation_content_color", + "value": "#F7F7F7" + }, + { + "name": "classify_header_input_placeholder", + "value": "#000000" + }, + { + "name": "classify_header_input_background", + "value": "#0D000000" + }, + { + "name": "categories_divider_color_selected", + "value": "#1A000000" + }, + { + "name": "categories_divider_color", + "value": "#D0092D" + }, + { + "name": "bag_discount_background", + "value": "#F2FAFAFA" + }, + { + "name": "shop_card_foot_button", + "value": "#CF0A2C" + }, + { + "name": "shop_card_font_color", + "value": "#CF0A2C" + }, + { + "name": "shop_card_type_font", + "value": "#99000000" + }, + { + "name": "add_button_border", + "value": "#333333" + }, + { + "name": "card_gift_font", + "value": "#E6000000" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/float.json b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..186c2ba6b6a25d6e17d314a0e9d09e3ecc9baf89 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/float.json @@ -0,0 +1,928 @@ +{ + "float": [ + { + "name": "bottom_tab_bar_width_lg", + "value": "96vp" + }, + { + "name": "side_tab_bar_height", + "value": "80vp" + }, + { + "name": "tab_font_size", + "value": "10fp" + }, + { + "name": "tab_top_margin", + "value": "4vp" + }, + { + "name": "top_bar_text_selected_font", + "value": "24fp" + }, + { + "name": "top_bar_text_font", + "value": "18fp" + }, + { + "name": "top_bar_text_selected_line", + "value": "32vp" + }, + { + "name": "top_bar_text_line", + "value": "24vp" + }, + { + "name": "top_bar_text_font_sel", + "value": "24fp" + }, + { + "name": "top_bar_text_line_sel", + "value": "33vp" + }, + { + "name": "top_text_padding_left_sm", + "value": "8vp" + }, + { + "name": "top_text_padding_right_sm", + "value": "16vp" + }, + { + "name": "top_text_padding_right_md", + "value": "24vp" + }, + { + "name": "top_text_padding_right_lg", + "value": "32vp" + }, + { + "name": "search_input_font", + "value": "16fp" + }, + { + "name": "search_input_height", + "value": "40vp" + }, + { + "name": "search_input_left", + "value": "36vp" + }, + { + "name": "search_input_right", + "value": "12vp" + }, + { + "name": "search_img_size", + "value": "16vp" + }, + { + "name": "search_img_left", + "value": "12vp" + }, + { + "name": "search_img_margin_sm", + "value": "16vp" + }, + { + "name": "search_img_margin", + "value": "24vp" + }, + { + "name": "category_img_size_sm", + "value": "40vp" + }, + { + "name": "category_img_size_md", + "value": "64vp" + }, + { + "name": "category_img_size_lg", + "value": "68vp" + }, + { + "name": "category_text_font", + "value": "12fp" + }, + { + "name": "category_text_line", + "value": "17vp" + }, + { + "name": "category_item_height_sm", + "value": "57vp" + }, + { + "name": "category_item_height_md", + "value": "81vp" + }, + { + "name": "category_item_height_lg", + "value": "85vp" + }, + { + "name": "category_lanes_gutter", + "value": "12vp" + }, + { + "name": "category_list_height_sm", + "value": "126vp" + }, + { + "name": "category_list_height_md", + "value": "81vp" + }, + { + "name": "category_list_height_lg", + "value": "85vp" + }, + { + "name": "category_divider_width", + "value": "24vp" + }, + { + "name": "category_divider_row_height", + "value": "32vp" + }, + { + "name": "category_col_height_sm", + "value": "126vp" + }, + { + "name": "category_col_height_md", + "value": "113vp" + }, + { + "name": "category_col_height_lg", + "value": "117vp" + }, + { + "name": "category_col_margin", + "value": "12vp" + }, + { + "name": "category_col_margin_sm", + "value": "16vp" + }, + { + "name": "welfare_image_size_sm", + "value": "60vp" + }, + { + "name": "welfare_image_size", + "value": "72vp" + }, + { + "name": "title_font", + "value": "16fp" + }, + { + "name": "title_line", + "value": "22vp" + }, + { + "name": "button_height", + "value": "28vp" + }, + { + "name": "button_width", + "value": "80vp" + }, + { + "name": "button_font", + "value": "12fp" + }, + { + "name": "title_height", + "value": "48vp" + }, + { + "name": "welfare_tip_font", + "value": "10fp" + }, + { + "name": "welfare_tip_line", + "value": "16vp" + }, + { + "name": "welfare_tip_width", + "value": "40vp" + }, + { + "name": "welfare_info_font", + "value": "12fp" + }, + { + "name": "welfare_info_line", + "value": "16vp" + }, + { + "name": "welfare_info_margin", + "value": "4vp" + }, + { + "name": "welfare_row_height_sm", + "value": "102vp" + }, + { + "name": "welfare_row_height_md", + "value": "114vp" + }, + { + "name": "welfare_row_height_lg", + "value": "118vp" + }, + { + "name": "welfare_row_padding_sm", + "value": "16vp" + }, + { + "name": "welfare_row_padding_md", + "value": "12vp" + }, + { + "name": "welfare_row_padding_lg", + "value": "20vp" + }, + { + "name": "welfare_col_height_sm", + "value": "162vp" + }, + { + "name": "welfare_col_height_md", + "value": "174vp" + }, + { + "name": "welfare_col_height_lg", + "value": "178vp" + }, + { + "name": "welfare_col_padding", + "value": "12vp" + }, + { + "name": "title_tip_font", + "value": "14fp" + }, + { + "name": "title_tip_line", + "value": "19vp" + }, + { + "name": "recommend_swiper_top_sm", + "value": "24vp" + }, + { + "name": "recommend_swiper_bottom_md", + "value": "12vp" + }, + { + "name": "recommend_swiper_bottom", + "value": "16vp" + }, + { + "name": "title_view_padding", + "value": "12vp" + }, + { + "name": "section_gutter_sm", + "value": "10vp" + }, + { + "name": "section_gutter_md", + "value": "12vp" + }, + { + "name": "section_gutter_lg", + "value": "8vp" + }, + { + "name": "section_live_margin", + "value": "8vp" + }, + { + "name": "section_image_margin_sm", + "value": "12vp" + }, + { + "name": "section_image_margin", + "value": "8vp" + }, + { + "name": "section_tip_text_line", + "value": "12vp" + }, + { + "name": "section_tip_text_size", + "value": "8fp" + }, + { + "name": "section_tip_text_margin", + "value": "2vp" + }, + { + "name": "section_tip_text_padding", + "value": "4vp" + }, + { + "name": "section_title_text_size", + "value": "14fp" + }, + { + "name": "section_title_text_line", + "value": "19vp" + }, + { + "name": "section_info_text_size", + "value": "12fp" + }, + { + "name": "section_info_text_line", + "value": "16vp" + }, + { + "name": "section_info_text_margin", + "value": "2vp" + }, + { + "name": "section_price_text_size", + "value": "14fp" + }, + { + "name": "section_price_text_line", + "value": "19vp" + }, + { + "name": "section_price_text_margin", + "value": "10vp" + }, + { + "name": "original_price_text_size", + "value": "8fp" + }, + { + "name": "original_price_text_line", + "value": "10vp" + }, + { + "name": "original_price_text_margin", + "value": "4vp" + }, + { + "name": "section_feature_text_size", + "value": "9fp" + }, + { + "name": "section_feature_text_line", + "value": "12vp" + }, + { + "name": "section_feature_padding", + "value": "4vp" + }, + { + "name": "section_feature_margin_top", + "value": "6vp" + }, + { + "name": "section_feature_margin_left", + "value": "4vp" + }, + { + "name": "section_comments_text_size", + "value": "10fp" + }, + { + "name": "section_comments_text_line", + "value": "14vp" + }, + { + "name": "section_comments_text_top", + "value": "6vp" + }, + { + "name": "section_comments_text_bottom", + "value": "12vp" + }, + { + "name": "section_margin_md", + "value": "12vp" + }, + { + "name": "section_margin", + "value": "16vp" + }, + { + "name": "section_feature_border_width", + "value": "1vp" + }, + { + "name": "section_feature_border_radius", + "value": "4vp" + }, + { + "name": "flash_sale_margin_lg", + "value": "16vp" + }, + { + "name": "flash_sale_margin", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_sm", + "value": "0" + }, + { + "name": "flash_grid_gutter_x_md", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_lg", + "value": "4vp" + }, + { + "name": "flash_grid_gutter_y", + "value": "12vp" + }, + { + "name": "flash_button_top", + "value": "8vp" + }, + { + "name": "flash_button_bottom", + "value": "12vp" + }, + { + "name": "flash_button_right", + "value": "8vp" + }, + { + "name": "flash_button_right_lg", + "value": "16vp" + }, + { + "name": "flash_row_margin", + "value": "12vp" + }, + { + "name": "classify_banner_height", + "value": "107vp" + }, + { + "name": "classify_swiper_indicator_width", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_height", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_selected_width", + "value": "12vp" + }, + { + "name": "classify_swiper_indicator_selected_height", + "value": "6vp" + }, + { + "name": "classify_swiper_next_margin_md", + "value": "13vp" + }, + { + "name": "classify_navigation_font_size", + "value": "14fp" + }, + { + "name": "classify_navigation_line_height", + "value": "19vp" + }, + { + "name": "classify_navigation_divider_height", + "value": "16vp" + }, + { + "name": "classify_navigation_bar_width_sm", + "value": "96vp" + }, + { + "name": "classify_navigation_bar_width_md", + "value": "144vp" + }, + { + "name": "classify_navigation_bar_width_lg", + "value": "200vp" + }, + { + "name": "classify_navigation_bar_height", + "value": "48vp" + }, + { + "name": "classify_header_input_font_size", + "value": "16fp" + }, + { + "name": "classify_header_input_height", + "value": "40vp" + }, + { + "name": "classify_header_input_padding_left", + "value": "36vp" + }, + { + "name": "classify_header_input_padding_right", + "value": "12vp" + }, + { + "name": "classify_header_input_search_size", + "value": "16vp" + }, + { + "name": "classify_header_input_search_margin", + "value": "16vp" + }, + { + "name": "classify_header_row_width", + "value": "328vp" + }, + { + "name": "classify_header_padding_left_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding", + "value": "24vp" + }, + { + "name": "classify_header_image_margin_sm", + "value": "16vp" + }, + { + "name": "classify_header_image_margin", + "value": "24vp" + }, + { + "name": "classify_banner_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_banner_padding_right_md", + "value": "0vp" + }, + { + "name": "classify_banner_padding_right_lg", + "value": "32vp" + }, + { + "name": "classify_destination_padding_top", + "value": "8vp" + }, + { + "name": "classify_destination_padding_left_sm", + "value": "4vp" + }, + { + "name": "classify_destination_padding_left", + "value": "0vp" + }, + { + "name": "classify_header_input_width", + "value": "232vp" + }, + { + "name": "shop_list_font", + "value": "16fp" + }, + { + "name": "shop_list_row_height", + "value": "48vp" + }, + { + "name": "list_name_font", + "value": "12fp" + }, + { + "name": "shop_grid_padding", + "value": "12vp" + }, + { + "name": "shop_col_padding_lg", + "value": "16vp" + }, + { + "name": "shop_col_padding", + "value": "12vp" + }, + { + "name": "shop_col_margin_lg", + "value": "16vp" + }, + { + "name": "shop_col_margin", + "value": "12vp" + }, + { + "name": "shop_list_margin", + "value": "12vp" + }, + { + "name": "bag_back_margin", + "value": "16vp" + }, + { + "name": "bag_title_font", + "value": "24fp" + }, + { + "name": "bag_name_font", + "value": "14fp" + }, + { + "name": "bag_close_margin", + "value": "24vp" + }, + { + "name": "bag_title_row_height", + "value": "56vp" + }, + { + "name": "bag_col_margin", + "value": "12vp" + }, + { + "name": "check_box_size", + "value": "18vp" + }, + { + "name": "check_box_group_margin", + "value": "12vp" + }, + { + "name": "bag_seller_logo_margin", + "value": "4vp" + }, + { + "name": "bag_seller_logo_border_width", + "value": "0.5vp" + }, + { + "name": "bag_card_title_row_height", + "value": "42vp" + }, + { + "name": "bag_card_check_box_margin", + "value": "14vp" + }, + { + "name": "bag_card_check_col_width", + "value": "32vp" + }, + { + "name": "bag_card_check_col_padding", + "value": "40vp" + }, + { + "name": "bag_card_row_padding", + "value": "12vp" + }, + { + "name": "bag_card_col_padding", + "value": "12vp" + }, + { + "name": "bag_discount_font_1", + "value": "20fp" + }, + { + "name": "bag_discount_font_2", + "value": "14fp" + }, + { + "name": "bag_discount_font_3", + "value": "16fp" + }, + { + "name": "bag_discount_line_1", + "value": "28vp" + }, + { + "name": "bag_discount_line_2", + "value": "19vp" + }, + { + "name": "bag_discount_line_3", + "value": "22vp" + }, + { + "name": "bag_discount_title_padding_top", + "value": "2vp" + }, + { + "name": "bag_discount_title_padding_bottom", + "value": "4vp" + }, + { + "name": "bag_discount_row_height", + "value": "48vp" + }, + { + "name": "bag_discount_padding", + "value": "12vp" + }, + { + "name": "bag_discount_margin", + "value": "16vp" + }, + { + "name": "bag_discount_col_padding_bottom", + "value": "12vp" + }, + { + "name": "shop_card_check_margin", + "value": "4vp" + }, + { + "name": "shop_card_font_1", + "value": "12fp" + }, + { + "name": "shop_card_font_2", + "value": "16fp" + }, + { + "name": "shop_card_font_3", + "value": "10fp" + }, + { + "name": "shop_card_line_1", + "value": "19vp" + }, + { + "name": "shop_card_line_2", + "value": "17vp" + }, + { + "name": "shop_card_line_3", + "value": "22vp" + }, + { + "name": "shop_card_line_4", + "value": "14vp" + }, + { + "name": "arrow_up_margin", + "value": "4vp" + }, + { + "name": "arrow_up_width", + "value": "8vp" + }, + { + "name": "arrow_up_height", + "value": "16vp" + }, + { + "name": "foot_button_height", + "value": "40vp" + }, + { + "name": "foot_button_width", + "value": "120vp" + }, + { + "name": "foot_button_margin", + "value": "8vp" + }, + { + "name": "foot_height", + "value": "56vp" + }, + { + "name": "foot_padding_more", + "value": "32vp" + }, + { + "name": "card_item_font_1", + "value": "13fp" + }, + { + "name": "card_item_font_2", + "value": "9fp" + }, + { + "name": "card_item_font_3", + "value": "12fp" + }, + { + "name": "card_item_font_4", + "value": "16fp" + }, + { + "name": "card_item_font_5", + "value": "10fp" + }, + { + "name": "card_item_font_6", + "value": "11fp" + }, + { + "name": "card_item_name_margin", + "value": "3vp" + }, + { + "name": "card_item_type_margin", + "value": "4vp" + }, + { + "name": "card_type_padding_row_top", + "value": "1vp" + }, + { + "name": "card_type_padding_row_left", + "value": "6vp" + }, + { + "name": "card_type_padding_row_right", + "value": "10vp" + }, + { + "name": "card_type_margin_row_bottom", + "value": "10vp" + }, + { + "name": "card_preferential_padding_top", + "value": "2vp" + }, + { + "name": "card_preferential_padding_left", + "value": "5vp" + }, + { + "name": "card_preferential_margin", + "value": "4vp" + }, + { + "name": "card_preferential_row_margin", + "value": "11vp" + }, + { + "name": "card_price_margin", + "value": "4vp" + }, + { + "name": "card_price_more_margin", + "value": "10vp" + }, + { + "name": "add_button_size", + "value": "24vp" + }, + { + "name": "add_button_border_width", + "value": "0.5vp" + }, + { + "name": "card_number_font", + "value": "13fp" + }, + { + "name": "card_number_width", + "value": "24vp" + }, + { + "name": "card_number_margin", + "value": "4vp" + }, + { + "name": "card_item_col_padding", + "value": "12vp" + }, + { + "name": "card_gift_width", + "value": "48vp" + }, + { + "name": "card_gift_row_margin_top", + "value": "4vp" + }, + { + "name": "card_gift_row_margin_bottom", + "value": "5vp" + }, + { + "name": "card_service_padding_left", + "value": "4vp" + }, + { + "name": "card_service_padding_top", + "value": "2vp" + }, + { + "name": "card_gift_row_padding", + "value": "42vp" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/string.json b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6bf49b76d4232f216e6abe29a9519ca2473ca88d --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/element/string.json @@ -0,0 +1,416 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "NAV_ROUTER_LIST1", + "value": "Phone" + }, + { + "name": "NAV_ROUTER_LIST2", + "value": "Wearable" + }, + { + "name": "NAV_ROUTER_LIST3", + "value": "Tablet" + }, + { + "name": "NAV_ROUTER_LIST4", + "value": "PC" + }, + { + "name": "NAV_ROUTER_LIST5", + "value": "Display&Print" + }, + { + "name": "NAV_ROUTER_LIST6", + "value": "Headphone" + }, + { + "name": "NAV_ROUTER_LIST7", + "value": "Vision" + }, + { + "name": "NAV_ROUTER_LIST8", + "value": "Lock&Router" + }, + { + "name": "NAV_ROUTER_LIST9", + "value": "Travel vehicle products" + }, + { + "name": "NAV_ROUTER_LIST10", + "value": "Digital accessories" + }, + { + "name": "NAV_ROUTER_LIST11", + "value": "Huawei Services" + }, + { + "name": "NAV_ROUTER_LIST12", + "value": "Digital content" + }, + { + "name": "NAV_ROUTER_LIST13", + "value": "Commercial terminal" + }, + { + "name": "NAV_ROUTER_LIST14", + "value": "Huawei Premium" + }, + { + "name": "NAV_ROUTER_LIST15", + "value": "Household Appliances" + }, + { + "name": "SHOP_TITLE_LIST1", + "value": "New products" + }, + { + "name": "SHOP_TITLE_LIST2", + "value": "2" + }, + { + "name": "SHOP_TITLE_LIST3", + "value": "HUAWEI P Series" + }, + { + "name": "search", + "value": "Search" + }, + { + "name": "FOOTER_TOPIC_LIST1", + "value": "Home" + }, + { + "name": "FOOTER_TOPIC_LIST2", + "value": "Categories" + }, + { + "name": "FOOTER_TOPIC_LIST3", + "value": "Discover" + }, + { + "name": "FOOTER_TOPIC_LIST4", + "value": "Cart" + }, + { + "name": "FOOTER_TOPIC_LIST5", + "value": "Personal" + }, + { + "name": "TOP_BAR_TEXTS1", + "value": "Huawei" + }, + { + "name": "TOP_BAR_TEXTS2", + "value": "AITO Car" + }, + { + "name": "TOP_BAR_TEXTS3", + "value": "Huawei Premium" + }, + { + "name": "TOP_BAR_TEXTS4", + "value": "Ecological Surroundings" + }, + { + "name": "searching", + "value": "Search..." + }, + { + "name": "GOOD_CATEGORIES1", + "value": "智慧办公" + }, + { + "name": "GOOD_CATEGORIES2", + "value": "智慧家居" + }, + { + "name": "GOOD_CATEGORIES3", + "value": "华为手机" + }, + { + "name": "GOOD_CATEGORIES4", + "value": "影音娱乐" + }, + { + "name": "GOOD_CATEGORIES5", + "value": "运动健康" + }, + { + "name": "GOOD_CATEGORIES6", + "value": "AITO汽车" + }, + { + "name": "GOOD_CATEGORIES7", + "value": "华为智选" + }, + { + "name": "GOOD_CATEGORIES8", + "value": "鸿蒙智联" + }, + { + "name": "GOOD_CATEGORIES9", + "value": "企业商用" + }, + { + "name": "GOOD_CATEGORIES10", + "value": "全屋智能" + }, + { + "name": "PRICE_UNIT", + "value": "起" + }, + { + "name": "HOME_TITLES1", + "value": "Welfare Zone" + }, + { + "name": "HOME_TITLES2", + "value": "Recommendation" + }, + { + "name": "HOME_TITLES3", + "value": "Time-Limited Discounts" + }, + { + "name": "BUTTON_TEXTS1", + "value": "Coupon" + }, + { + "name": "BUTTON_TEXTS2", + "value": "Buy" + }, + { + "name": "TIP_TEXTS1", + "value": "用券价" + }, + { + "name": "TIP_TEXTS2", + "value": "More" + }, + { + "name": "TIP_TEXTS3", + "value": "新品" + }, + { + "name": "SECTION_PRODUCTS_TITLES1", + "value": "MateBook X Pro 12代" + }, + { + "name": "SECTION_PRODUCTS_TITLES2", + "value": "新品" + }, + { + "name": "SECTION_PRODUCTS_INFO1", + "value": "北斗卫星消息 | 低电量应急模式" + }, + { + "name": "SECTION_PRODUCTS_INFO2", + "value": "144Hz高割全面屏" + }, + { + "name": "SECTION_PRODUCTS_INFO3", + "value": "32GB大内存 | 13代酷睿处理器 | 超级终端" + }, + { + "name": "SECTION_PRODUCTS_FEATURES1", + "value": "V1-V5优惠400元/12期免息" + }, + { + "name": "SECTION_PRODUCTS_FEATURES2", + "value": "新一代直屏旗舰机" + }, + { + "name": "SECTION_PRODUCTS_FEATURES3", + "value": "最高省100" + }, + { + "name": "SECTION_PRODUCTS_FEATURES4", + "value": "限时直降300" + }, + { + "name": "SECTION_PRODUCTS_FEATURES5", + "value": "最高省300" + }, + { + "name": "SHOPPING_BAG_TITLES1", + "value": "Cart" + }, + { + "name": "SHOPPING_BAG_TITLES2", + "value": "Manage" + }, + { + "name": "SHOPPING_BAG_TITLES3", + "value": "Huawei official flagship store" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES1", + "value": "Select All" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES2", + "value": "Total:" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES3", + "value": "Discounted ¥1000" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES4", + "value": "Check out(1)" + }, + { + "name": "HOME_REVIEW", + "value": "2.57K Reviews, 95% Positive" + }, + { + "name": "Hot_Seller", + "value": "Hot Seller" + }, + { + "name": "New_Launch", + "value": "New Launch" + }, + { + "name": "SECTION_PRODUCTS_INFO4", + "value": "New Front 60MP Ultra-Wide Lens" + }, + { + "name": "SECTION_PRODUCTS_INFO5", + "value": "2.5K HR Screen | Lt, Thin, Long Batt Life" + }, + { + "name": "SECTION_PRODUCTS_INFO6", + "value": "Thin, Flat, Reliable" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES1", + "value": "Next-Gen Straight Flagship" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES2", + "value": "Award Points" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES3", + "value": "Ltd Time: 6M Int-Free" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES4", + "value": "V1-V5: ¥100 Off | Free Classic Headphones" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES5", + "value": "Pre-order Perf. Ed., Save ¥200" + }, + { + "name": "PRODUCT_NAME_LIST1", + "value": "HuaWei Mate 50 Pro 256GB Frosty Silver (Kunlun Glass)" + }, + { + "name": "PRODUCT_NAME_LIST2", + "value": "HuaWei Mate 60 12+1TB Yadan Black (Std Config)" + }, + { + "name": "PRODUCT_NAME_LIST3", + "value": "【In Stock】HUAWEI Mate X5 12+512GB Phantom Purple" + }, + { + "name": "PRODUCT_TYPE_LIST1", + "value": "Frosty Silver 256GB (Kunlun Glass), Std Config, Fast Shipping" + }, + { + "name": "PRODUCT_TYPE_LIS2", + "value": "Yadan Black 12+1TB, Std Config, Pre-order OK" + }, + { + "name": "PRODUCT_TYPE_LIST3", + "value": "Phantom Purple 512+12GB, Std Config, Fast Shipping" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE1", + "value": "0% Interest" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE2", + "value": "Ltd Time Offer" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE3", + "value": "Next-Gen Straight Flagship" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE4", + "value": "Points" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE1", + "value": "HUAWEI FreeLace Headphones …" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE2", + "value": "Mate 60 Ring Flash Case (Blk)" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE3", + "value": "Mate 50 Ring Flash Case (Silver)" + }, + { + "name": "PRODUCT_SERVICE_LIST_message", + "value": "Worry-Free Service" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE1", + "value": "total price" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE2", + "value": "coupon" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE3", + "value": "discount" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE4", + "value": "sum" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE5", + "value": "offer breakdown" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE6", + "value": "Actual discount shown at checkout." + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE7", + "value": "delivery" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE8", + "value": "indicate delivery" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE9", + "value": "E-Invoice for Individuals" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE10", + "value": "【gift】" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE11", + "value": "【Service】" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE12", + "value": "event offer" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_1.png new file mode 100644 index 0000000000000000000000000000000000000000..6cfc761a556105237b59ef03a3066351dffa712e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_10.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_10.png new file mode 100644 index 0000000000000000000000000000000000000000..0066a5fe9d112e4887abc82792db0af744a8a5d3 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_10.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ee52a99bcb3fe606f8cebece363b6a79985fc277 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_3.png new file mode 100644 index 0000000000000000000000000000000000000000..c159bae6faa5ade358597527b853646a703441f3 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_4.png new file mode 100644 index 0000000000000000000000000000000000000000..aa1285d517c3adcc2dc483789ed6e841e4c713e9 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_5.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_5.png new file mode 100644 index 0000000000000000000000000000000000000000..4ae1606c81963905bedcaa07ea654c210f45e1a4 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_5.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_6.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_6.png new file mode 100644 index 0000000000000000000000000000000000000000..fe91e1421c874bf9192a82c3d496149fdb218bea Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_6.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_7.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_7.png new file mode 100644 index 0000000000000000000000000000000000000000..60637700c20352473cd69163b6011aec9e5b12c0 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_7.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_8.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_8.png new file mode 100644 index 0000000000000000000000000000000000000000..590359291d5757415ef1de3fd5fdf23e49ad4e17 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_8.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_9.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_9.png new file mode 100644 index 0000000000000000000000000000000000000000..93da6c549f2bacb352104ecc10bfc697be5b9841 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/categories_9.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner1.png new file mode 100644 index 0000000000000000000000000000000000000000..9236adc5eb9afaa7f9e9629efc9ae8de5e7ee9c0 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner2.png new file mode 100644 index 0000000000000000000000000000000000000000..4995e520d35f9fa08fbe74a00625eed209cf7c37 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner3.png new file mode 100644 index 0000000000000000000000000000000000000000..d20821d37c786a8123e81070dce72776edff9398 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_banner3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..e6e9c9fa24cb3fddd2cce49e398f661582da927c Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_10.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_10.png new file mode 100644 index 0000000000000000000000000000000000000000..33410003b897f5f1bbe1ade0eb5bf6b16d221883 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_10.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_11.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_11.png new file mode 100644 index 0000000000000000000000000000000000000000..1f3a94a81d406cd7b6e1c582ec51ac0d3f20082b Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_11.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_12.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_12.png new file mode 100644 index 0000000000000000000000000000000000000000..d13d60f2af8c8d73b1019c3a6a0acf166e5395da Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_12.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_13.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_13.png new file mode 100644 index 0000000000000000000000000000000000000000..2550b1f5e65910f731a72a7ff98ba351fb119545 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_13.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_14.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_14.png new file mode 100644 index 0000000000000000000000000000000000000000..2062cb0a1bbbe69126ac1851052064aa2fa3bd3a Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_14.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_15.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_15.png new file mode 100644 index 0000000000000000000000000000000000000000..a1852a4d2101956d2b8969b026ab62aedff32b80 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_15.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_16.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_16.png new file mode 100644 index 0000000000000000000000000000000000000000..b1143646120a8a61e1b331ce54b142770176b8a4 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_16.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e21569dc30d8a3c6dcacfabc205485b4066e3fa9 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..9d8359d4106a05e8e62f13a930d854565a84aa07 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..ccf33c2416789c75b6f4b2ca043dc31d01ecd545 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_5.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_5.png new file mode 100644 index 0000000000000000000000000000000000000000..7c993a12dff3bafdedac31d5545ddec03c932a41 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_5.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_6.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_6.png new file mode 100644 index 0000000000000000000000000000000000000000..d54f13c6185100d470a4b8345c759ba0eb24389c Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_6.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_7.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_7.png new file mode 100644 index 0000000000000000000000000000000000000000..451fe509517312a070cbfba043da95d6d6bef113 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_7.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_8.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_8.png new file mode 100644 index 0000000000000000000000000000000000000000..db04f3ad9fc1a63d5ce47ba87777930a5743df0d Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_8.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_9.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_9.png new file mode 100644 index 0000000000000000000000000000000000000000..7a530109f99bbd4cdda45b936c63b5baaddbf4e1 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/classify_product_9.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..5edf68332180fa8b8b7592877cbfe9d16ad1515f Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ff6c061e300075f074426836a9955cd7926597a1 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..8c8a06488fb4eb73d3397ddc5436ea9e052c63b5 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..03ee3e91f3333561ac57e8bc5440f509a519f826 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/flash_sale_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_down.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_down.svg new file mode 100644 index 0000000000000000000000000000000000000000..f4c8cd335da5e7f0e8e9ee6d2a8f6e081b7149f1 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_down.svg @@ -0,0 +1,15 @@ + + + + 画板 + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_up.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_up.svg new file mode 100644 index 0000000000000000000000000000000000000000..49479cfd03ead96668b93a3e1e3dcfefd3fca09f --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_arrow_up.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_arrow_up_0 + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_back.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..454d0aa4b65c47c8281eb78cbc6b9e4b3c9ee454 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_back + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_comments.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_more_list.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_more_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..0a26842c9e251d43ca0e404c240f612b5268f799 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_more_list.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_more_list + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_scan.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_scan.svg new file mode 100644 index 0000000000000000000000000000000000000000..2fcee34964f6c70c95fdff0e67d8359cbcd8b8e0 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_scan.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_scan + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_search.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..423182ce01e353a362155bdb443b9686672631d9 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/ic_public_search.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_search + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_close.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..ac485ef36a8d7376bc340c6450a80400cf7d3ab3 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_close.svg @@ -0,0 +1,20 @@ + + + 切片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_is_living.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_is_living.svg new file mode 100644 index 0000000000000000000000000000000000000000..726db83d386b182104584ea6be76dd27f12f883c --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/icon_is_living.svg @@ -0,0 +1,27 @@ + + + icon_video + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..6e32e722c59345dfa1c2f3bb8d241200fabf8e21 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..93561198f1c5c82728b143147ae64e6ab77e68c0 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..deeecb47f47d83e08b3fe7fe3b1f4e3c13216634 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..a808afb23e001f793561167f88f34a76e47e908e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/recommended_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..ed9c39e53c9c69cd0bd8629bca202ef55e16529f Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..f4018f03d76333f331d5be3d71916b13afd5f91b Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..35a7d962b333b1aee8f6ea9395578e42ad236c04 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..11ee216a64b0acdc0523e35b9e2be17add16657e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_5.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_5.png new file mode 100644 index 0000000000000000000000000000000000000000..10ee08cbe07f41ed5a2b75f43cfa016705da3d8b Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/section_product_5.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_1.png new file mode 100644 index 0000000000000000000000000000000000000000..042d89d5af60b6375b32499ddb2a88479173d59e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_2.png new file mode 100644 index 0000000000000000000000000000000000000000..6c5d9e25aad390869a8cef6f0b14710173982b8a Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_3.png new file mode 100644 index 0000000000000000000000000000000000000000..bb870636013c3b271d891daa66bcd1c5489a1547 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_logo.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..50d38e46af32dae2e8825ffbcbc3e737bd3df158 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/shopping_card_logo.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification.svg new file mode 100644 index 0000000000000000000000000000000000000000..9f55f817678348f533d7002ba94019d7563b9a80 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification.svg @@ -0,0 +1,13 @@ + + + BottomNavigationBar/item/icon_actived分类-2 + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification_selected.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..3ca24b33dad63ae555f9ad7e9c4a05f0c4167565 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_classification_selected.svg @@ -0,0 +1,24 @@ + + + 编组 5 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery.svg new file mode 100644 index 0000000000000000000000000000000000000000..15ce5e9164a463af2d45364386475dd5ecc5ee8a --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery.svg @@ -0,0 +1,22 @@ + + + tab/ic_备份 68 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery_selected.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..86966ac46d940c2b0f25e905c8f1aac5aa617e33 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_discovery_selected.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home.svg new file mode 100644 index 0000000000000000000000000000000000000000..ff026a99092323be572eb3f9e08aade115048a00 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home.svg @@ -0,0 +1,13 @@ + + + BottomNavigationBar/item/icon_actived首页-2 + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home_selected.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..a14f5eeb73edceaaa586e00cc4c4615a4e041d92 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_home_selected.svg @@ -0,0 +1,24 @@ + + + 编组 11 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine.svg new file mode 100644 index 0000000000000000000000000000000000000000..497aa389aff3a80401c630a7197e1139a318e9fa --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine.svg @@ -0,0 +1,13 @@ + + + @0.5xBottomNavigationBar/item/icon_actived-我的=2 + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine_selected.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..b68885d34202b0a15f9f74cd115a378577f81a86 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_mine_selected.svg @@ -0,0 +1,21 @@ + + + mdpi/BottomNavigationBar/item/icon_actived-我的 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag.svg new file mode 100644 index 0000000000000000000000000000000000000000..3db480cb716220eca74972f4a009624fa54d4b0e --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_appstore + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag_selected.svg b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..009806198486821b074e5b6328f89dddd895fdd5 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/tab_shopping_bag_selected.svg @@ -0,0 +1,24 @@ + + + tab/ic_备份 68 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_1.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_1.png new file mode 100644 index 0000000000000000000000000000000000000000..be1f3d1b50b92e8f41b69c4079466fc7f2c9a23e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_1.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_2.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_2.png new file mode 100644 index 0000000000000000000000000000000000000000..6b2fd7dfb43a78628c99b0dfff3ebd4a6f579db1 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_2.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_3.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_3.png new file mode 100644 index 0000000000000000000000000000000000000000..25c8185235dfb33dbe88ec122863b780f77aadbc Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_3.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_4.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_4.png new file mode 100644 index 0000000000000000000000000000000000000000..76612e3a2b723a77c39ddaba082f1fef6036e524 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_4.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_5.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_5.png new file mode 100644 index 0000000000000000000000000000000000000000..88d946927f3ccd0e6be46617f4ed202d0e9cd9b5 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_5.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_6.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_6.png new file mode 100644 index 0000000000000000000000000000000000000000..b71ea0e327827de31e555a975003453e13fc2a13 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_6.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_7.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_7.png new file mode 100644 index 0000000000000000000000000000000000000000..65cde10c7532947f015f541976d767542f8782b3 Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_7.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_8.png b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_8.png new file mode 100644 index 0000000000000000000000000000000000000000..a71df7b03a0e6fdc138d61f65a64564d817ffb6e Binary files /dev/null and b/MultiShoppingPriceComparison/features/home/src/main/resources/base/media/welfare_product_8.png differ diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/float.json b/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..9bd124239187a3c11bccc7bb0e51427e7bb26b6d --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/float.json @@ -0,0 +1,928 @@ +{ + "float": [ + { + "name": "bottom_tab_bar_width_lg", + "value": "96vp" + }, + { + "name": "side_tab_bar_height", + "value": "80vp" + }, + { + "name": "tab_font_size", + "value": "10fp" + }, + { + "name": "tab_top_margin", + "value": "4vp" + }, + { + "name": "top_bar_text_selected_font", + "value": "24fp" + }, + { + "name": "top_bar_text_font", + "value": "18fp" + }, + { + "name": "top_bar_text_selected_line", + "value": "32vp" + }, + { + "name": "top_bar_text_line", + "value": "24vp" + }, + { + "name": "top_bar_text_font_sel", + "value": "24fp" + }, + { + "name": "top_bar_text_line_sel", + "value": "33vp" + }, + { + "name": "top_text_padding_left_sm", + "value": "8vp" + }, + { + "name": "top_text_padding_right_sm", + "value": "16vp" + }, + { + "name": "top_text_padding_right_md", + "value": "24vp" + }, + { + "name": "top_text_padding_right_lg", + "value": "32vp" + }, + { + "name": "search_input_font", + "value": "16fp" + }, + { + "name": "search_input_height", + "value": "40vp" + }, + { + "name": "search_input_left", + "value": "36vp" + }, + { + "name": "search_input_right", + "value": "12vp" + }, + { + "name": "search_img_size", + "value": "16vp" + }, + { + "name": "search_img_left", + "value": "12vp" + }, + { + "name": "search_img_margin_sm", + "value": "16vp" + }, + { + "name": "search_img_margin", + "value": "24vp" + }, + { + "name": "category_img_size_sm", + "value": "40vp" + }, + { + "name": "category_img_size_md", + "value": "64vp" + }, + { + "name": "category_img_size_lg", + "value": "68vp" + }, + { + "name": "category_text_font", + "value": "12fp" + }, + { + "name": "category_text_line", + "value": "17vp" + }, + { + "name": "category_item_height_sm", + "value": "57vp" + }, + { + "name": "category_item_height_md", + "value": "81vp" + }, + { + "name": "category_item_height_lg", + "value": "85vp" + }, + { + "name": "category_lanes_gutter", + "value": "12vp" + }, + { + "name": "category_list_height_sm", + "value": "126vp" + }, + { + "name": "category_list_height_md", + "value": "81vp" + }, + { + "name": "category_list_height_lg", + "value": "85vp" + }, + { + "name": "category_divider_width", + "value": "24vp" + }, + { + "name": "category_divider_row_height", + "value": "32vp" + }, + { + "name": "category_col_height_sm", + "value": "126vp" + }, + { + "name": "category_col_height_md", + "value": "113vp" + }, + { + "name": "category_col_height_lg", + "value": "117vp" + }, + { + "name": "category_col_margin", + "value": "12vp" + }, + { + "name": "category_col_margin_sm", + "value": "16vp" + }, + { + "name": "welfare_image_size_sm", + "value": "60vp" + }, + { + "name": "welfare_image_size", + "value": "72vp" + }, + { + "name": "title_font", + "value": "16fp" + }, + { + "name": "title_line", + "value": "22vp" + }, + { + "name": "button_height", + "value": "28vp" + }, + { + "name": "button_width", + "value": "80vp" + }, + { + "name": "button_font", + "value": "12fp" + }, + { + "name": "title_height", + "value": "48vp" + }, + { + "name": "welfare_tip_font", + "value": "10fp" + }, + { + "name": "welfare_tip_line", + "value": "16vp" + }, + { + "name": "welfare_tip_width", + "value": "40vp" + }, + { + "name": "welfare_info_font", + "value": "12fp" + }, + { + "name": "welfare_info_line", + "value": "16vp" + }, + { + "name": "welfare_info_margin", + "value": "4vp" + }, + { + "name": "welfare_row_height_sm", + "value": "102vp" + }, + { + "name": "welfare_row_height_md", + "value": "114vp" + }, + { + "name": "welfare_row_height_lg", + "value": "118vp" + }, + { + "name": "welfare_row_padding_sm", + "value": "16vp" + }, + { + "name": "welfare_row_padding_md", + "value": "12vp" + }, + { + "name": "welfare_row_padding_lg", + "value": "20vp" + }, + { + "name": "welfare_col_height_sm", + "value": "162vp" + }, + { + "name": "welfare_col_height_md", + "value": "174vp" + }, + { + "name": "welfare_col_height_lg", + "value": "178vp" + }, + { + "name": "welfare_col_padding", + "value": "12vp" + }, + { + "name": "title_tip_font", + "value": "14fp" + }, + { + "name": "title_tip_line", + "value": "19vp" + }, + { + "name": "recommend_swiper_top_sm", + "value": "24vp" + }, + { + "name": "recommend_swiper_bottom_md", + "value": "12vp" + }, + { + "name": "recommend_swiper_bottom", + "value": "16vp" + }, + { + "name": "title_view_padding", + "value": "12vp" + }, + { + "name": "section_gutter_sm", + "value": "10vp" + }, + { + "name": "section_gutter_md", + "value": "12vp" + }, + { + "name": "section_gutter_lg", + "value": "8vp" + }, + { + "name": "section_live_margin", + "value": "8vp" + }, + { + "name": "section_image_margin_sm", + "value": "12vp" + }, + { + "name": "section_image_margin", + "value": "8vp" + }, + { + "name": "section_tip_text_line", + "value": "12vp" + }, + { + "name": "section_tip_text_size", + "value": "8fp" + }, + { + "name": "section_tip_text_margin", + "value": "2vp" + }, + { + "name": "section_tip_text_padding", + "value": "4vp" + }, + { + "name": "section_title_text_size", + "value": "14fp" + }, + { + "name": "section_title_text_line", + "value": "19vp" + }, + { + "name": "section_info_text_size", + "value": "12fp" + }, + { + "name": "section_info_text_line", + "value": "16vp" + }, + { + "name": "section_info_text_margin", + "value": "2vp" + }, + { + "name": "section_price_text_size", + "value": "14fp" + }, + { + "name": "section_price_text_line", + "value": "19vp" + }, + { + "name": "section_price_text_margin", + "value": "10vp" + }, + { + "name": "original_price_text_size", + "value": "8fp" + }, + { + "name": "original_price_text_line", + "value": "10vp" + }, + { + "name": "original_price_text_margin", + "value": "4vp" + }, + { + "name": "section_feature_text_size", + "value": "9fp" + }, + { + "name": "section_feature_text_line", + "value": "12vp" + }, + { + "name": "section_feature_padding", + "value": "4vp" + }, + { + "name": "section_feature_margin_top", + "value": "6vp" + }, + { + "name": "section_feature_margin_left", + "value": "4vp" + }, + { + "name": "section_comments_text_size", + "value": "10fp" + }, + { + "name": "section_comments_text_line", + "value": "14vp" + }, + { + "name": "section_comments_text_top", + "value": "6vp" + }, + { + "name": "section_comments_text_bottom", + "value": "12vp" + }, + { + "name": "section_margin_md", + "value": "12vp" + }, + { + "name": "section_margin", + "value": "16vp" + }, + { + "name": "section_feature_border_width", + "value": "1vp" + }, + { + "name": "section_feature_border_radius", + "value": "4vp" + }, + { + "name": "flash_sale_margin_lg", + "value": "16vp" + }, + { + "name": "flash_sale_margin", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_sm", + "value": "0" + }, + { + "name": "flash_grid_gutter_x_md", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_lg", + "value": "4vp" + }, + { + "name": "flash_grid_gutter_y", + "value": "12vp" + }, + { + "name": "flash_button_top", + "value": "8vp" + }, + { + "name": "flash_button_bottom", + "value": "12vp" + }, + { + "name": "flash_button_right", + "value": "8vp" + }, + { + "name": "flash_button_right_lg", + "value": "16vp" + }, + { + "name": "flash_row_margin", + "value": "12vp" + }, + { + "name": "classify_banner_height", + "value": "107vp" + }, + { + "name": "classify_swiper_indicator_width", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_height", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_selected_width", + "value": "12vp" + }, + { + "name": "classify_swiper_indicator_selected_height", + "value": "6vp" + }, + { + "name": "classify_swiper_next_margin_md", + "value": "13vp" + }, + { + "name": "classify_navigation_font_size", + "value": "14fp" + }, + { + "name": "classify_navigation_line_height", + "value": "19vp" + }, + { + "name": "classify_navigation_divider_height", + "value": "16vp" + }, + { + "name": "classify_navigation_bar_width_sm", + "value": "96vp" + }, + { + "name": "classify_navigation_bar_width_md", + "value": "144vp" + }, + { + "name": "classify_navigation_bar_width_lg", + "value": "200vp" + }, + { + "name": "classify_navigation_bar_height", + "value": "48vp" + }, + { + "name": "classify_header_input_font_size", + "value": "16fp" + }, + { + "name": "classify_header_input_height", + "value": "40vp" + }, + { + "name": "classify_header_input_padding_left", + "value": "36vp" + }, + { + "name": "classify_header_input_padding_right", + "value": "12vp" + }, + { + "name": "classify_header_input_search_size", + "value": "16vp" + }, + { + "name": "classify_header_input_search_margin", + "value": "16vp" + }, + { + "name": "classify_header_row_width", + "value": "328vp" + }, + { + "name": "classify_header_padding_left_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding", + "value": "24vp" + }, + { + "name": "classify_header_image_margin_sm", + "value": "16vp" + }, + { + "name": "classify_header_image_margin", + "value": "24vp" + }, + { + "name": "classify_banner_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_banner_padding_right_md", + "value": "0vp" + }, + { + "name": "classify_banner_padding_right_lg", + "value": "32vp" + }, + { + "name": "classify_destination_padding_top", + "value": "8vp" + }, + { + "name": "classify_destination_padding_left_sm", + "value": "4vp" + }, + { + "name": "classify_destination_padding_left", + "value": "0vp" + }, + { + "name": "classify_header_input_width", + "value": "232vp" + }, + { + "name": "shop_list_font", + "value": "16fp" + }, + { + "name": "shop_list_row_height", + "value": "48vp" + }, + { + "name": "list_name_font", + "value": "12fp" + }, + { + "name": "shop_grid_padding", + "value": "12vp" + }, + { + "name": "shop_col_padding_lg", + "value": "16vp" + }, + { + "name": "shop_col_padding", + "value": "12vp" + }, + { + "name": "shop_col_margin_lg", + "value": "16vp" + }, + { + "name": "shop_col_margin", + "value": "12vp" + }, + { + "name": "shop_list_margin", + "value": "12vp" + }, + { + "name": "bag_back_margin", + "value": "16vp" + }, + { + "name": "bag_title_font", + "value": "24fp" + }, + { + "name": "bag_name_font", + "value": "14fp" + }, + { + "name": "bag_close_margin", + "value": "24vp" + }, + { + "name": "bag_title_row_height", + "value": "56vp" + }, + { + "name": "bag_col_margin", + "value": "12vp" + }, + { + "name": "check_box_size", + "value": "18vp" + }, + { + "name": "check_box_group_margin", + "value": "12vp" + }, + { + "name": "bag_seller_logo_margin", + "value": "4vp" + }, + { + "name": "bag_seller_logo_border_width", + "value": "0.5vp" + }, + { + "name": "bag_card_title_row_height", + "value": "42vp" + }, + { + "name": "bag_card_check_box_margin", + "value": "14vp" + }, + { + "name": "bag_card_check_col_width", + "value": "32vp" + }, + { + "name": "bag_card_check_col_padding", + "value": "40vp" + }, + { + "name": "bag_card_row_padding", + "value": "12vp" + }, + { + "name": "bag_card_col_padding", + "value": "12vp" + }, + { + "name": "bag_discount_font_1", + "value": "20fp" + }, + { + "name": "bag_discount_font_2", + "value": "14fp" + }, + { + "name": "bag_discount_font_3", + "value": "16fp" + }, + { + "name": "bag_discount_line_1", + "value": "28vp" + }, + { + "name": "bag_discount_line_2", + "value": "19vp" + }, + { + "name": "bag_discount_line_3", + "value": "22vp" + }, + { + "name": "bag_discount_title_padding_top", + "value": "2vp" + }, + { + "name": "bag_discount_title_padding_bottom", + "value": "4vp" + }, + { + "name": "bag_discount_row_height", + "value": "48vp" + }, + { + "name": "bag_discount_padding", + "value": "12vp" + }, + { + "name": "bag_discount_margin", + "value": "16vp" + }, + { + "name": "bag_discount_col_padding_bottom", + "value": "12vp" + }, + { + "name": "shop_card_check_margin", + "value": "4vp" + }, + { + "name": "shop_card_font_1", + "value": "12fp" + }, + { + "name": "shop_card_font_2", + "value": "14fp" + }, + { + "name": "shop_card_font_3", + "value": "10fp" + }, + { + "name": "shop_card_line_1", + "value": "19vp" + }, + { + "name": "shop_card_line_2", + "value": "17vp" + }, + { + "name": "shop_card_line_3", + "value": "22vp" + }, + { + "name": "shop_card_line_4", + "value": "14vp" + }, + { + "name": "arrow_up_margin", + "value": "4vp" + }, + { + "name": "arrow_up_width", + "value": "8vp" + }, + { + "name": "arrow_up_height", + "value": "16vp" + }, + { + "name": "foot_button_height", + "value": "40vp" + }, + { + "name": "foot_button_width", + "value": "120vp" + }, + { + "name": "foot_button_margin", + "value": "8vp" + }, + { + "name": "foot_height", + "value": "56vp" + }, + { + "name": "foot_padding_more", + "value": "32vp" + }, + { + "name": "card_item_font_1", + "value": "13fp" + }, + { + "name": "card_item_font_2", + "value": "9fp" + }, + { + "name": "card_item_font_3", + "value": "12fp" + }, + { + "name": "card_item_font_4", + "value": "16fp" + }, + { + "name": "card_item_font_5", + "value": "10fp" + }, + { + "name": "card_item_font_6", + "value": "11fp" + }, + { + "name": "card_item_name_margin", + "value": "3vp" + }, + { + "name": "card_item_type_margin", + "value": "4vp" + }, + { + "name": "card_type_padding_row_top", + "value": "1vp" + }, + { + "name": "card_type_padding_row_left", + "value": "6vp" + }, + { + "name": "card_type_padding_row_right", + "value": "10vp" + }, + { + "name": "card_type_margin_row_bottom", + "value": "10vp" + }, + { + "name": "card_preferential_padding_top", + "value": "2vp" + }, + { + "name": "card_preferential_padding_left", + "value": "5vp" + }, + { + "name": "card_preferential_margin", + "value": "4vp" + }, + { + "name": "card_preferential_row_margin", + "value": "11vp" + }, + { + "name": "card_price_margin", + "value": "4vp" + }, + { + "name": "card_price_more_margin", + "value": "10vp" + }, + { + "name": "add_button_size", + "value": "24vp" + }, + { + "name": "add_button_border_width", + "value": "0.5vp" + }, + { + "name": "card_number_font", + "value": "13fp" + }, + { + "name": "card_number_width", + "value": "24vp" + }, + { + "name": "card_number_margin", + "value": "4vp" + }, + { + "name": "card_item_col_padding", + "value": "12vp" + }, + { + "name": "card_gift_width", + "value": "48vp" + }, + { + "name": "card_gift_row_margin_top", + "value": "4vp" + }, + { + "name": "card_gift_row_margin_bottom", + "value": "5vp" + }, + { + "name": "card_service_padding_left", + "value": "4vp" + }, + { + "name": "card_service_padding_top", + "value": "2vp" + }, + { + "name": "card_gift_row_padding", + "value": "42vp" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/string.json b/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8e0c5018a71a6195b55f2801921644c889a03056 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/en_US/element/string.json @@ -0,0 +1,416 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "NAV_ROUTER_LIST1", + "value": "Phone" + }, + { + "name": "NAV_ROUTER_LIST2", + "value": "Wearable" + }, + { + "name": "NAV_ROUTER_LIST3", + "value": "Tablet" + }, + { + "name": "NAV_ROUTER_LIST4", + "value": "PC" + }, + { + "name": "NAV_ROUTER_LIST5", + "value": "Display & Print" + }, + { + "name": "NAV_ROUTER_LIST6", + "value": "Headphone" + }, + { + "name": "NAV_ROUTER_LIST7", + "value": "Vision" + }, + { + "name": "NAV_ROUTER_LIST8", + "value": "Lock & Router" + }, + { + "name": "NAV_ROUTER_LIST9", + "value": "Vehicle Product" + }, + { + "name": "NAV_ROUTER_LIST10", + "value": "Digital Accessories" + }, + { + "name": "NAV_ROUTER_LIST11", + "value": "Huawei Services" + }, + { + "name": "NAV_ROUTER_LIST12", + "value": "Digital Content" + }, + { + "name": "NAV_ROUTER_LIST13", + "value": "Commercial Terminal" + }, + { + "name": "NAV_ROUTER_LIST14", + "value": "Huawei Premium" + }, + { + "name": "NAV_ROUTER_LIST15", + "value": "Household Appliances" + }, + { + "name": "SHOP_TITLE_LIST1", + "value": "New Products" + }, + { + "name": "SHOP_TITLE_LIST2", + "value": "HUAWEI Mate Series" + }, + { + "name": "SHOP_TITLE_LIST3", + "value": "HUAWEI P Series" + }, + { + "name": "search", + "value": "Search" + }, + { + "name": "FOOTER_TOPIC_LIST1", + "value": "Home" + }, + { + "name": "FOOTER_TOPIC_LIST2", + "value": "Categories" + }, + { + "name": "FOOTER_TOPIC_LIST3", + "value": "Discover" + }, + { + "name": "FOOTER_TOPIC_LIST4", + "value": "Cart" + }, + { + "name": "FOOTER_TOPIC_LIST5", + "value": "Personal" + }, + { + "name": "TOP_BAR_TEXTS1", + "value": "Huawei" + }, + { + "name": "TOP_BAR_TEXTS2", + "value": "AITO Car" + }, + { + "name": "TOP_BAR_TEXTS3", + "value": "Huawei Premium" + }, + { + "name": "TOP_BAR_TEXTS4", + "value": "Ecological Surroundings" + }, + { + "name": "searching", + "value": "Search..." + }, + { + "name": "GOOD_CATEGORIES1", + "value": "Office" + }, + { + "name": "GOOD_CATEGORIES3", + "value": "Phone" + }, + { + "name": "GOOD_CATEGORIES2", + "value": "Household" + }, + { + "name": "GOOD_CATEGORIES4", + "value": "Audio" + }, + { + "name": "GOOD_CATEGORIES5", + "value": "Sports" + }, + { + "name": "GOOD_CATEGORIES6", + "value": "AITO Cars" + }, + { + "name": "GOOD_CATEGORIES7", + "value": "Select" + }, + { + "name": "GOOD_CATEGORIES8", + "value": "Connect" + }, + { + "name": "GOOD_CATEGORIES9", + "value": "Business" + }, + { + "name": "GOOD_CATEGORIES10", + "value": "Solutions" + }, + { + "name": "PRICE_UNIT", + "value": "" + }, + { + "name": "HOME_TITLES1", + "value": "Welfare Zone" + }, + { + "name": "HOME_TITLES2", + "value": "Recommendation" + }, + { + "name": "HOME_TITLES3", + "value": "Time-Limited Discounts" + }, + { + "name": "BUTTON_TEXTS2", + "value": "Buy" + }, + { + "name": "BUTTON_TEXTS1", + "value": "Coupon" + }, + { + "name": "TIP_TEXTS1", + "value": "Disc." + }, + { + "name": "TIP_TEXTS2", + "value": "More" + }, + { + "name": "TIP_TEXTS3", + "value": "New" + }, + { + "name": "SECTION_PRODUCTS_TITLES1", + "value": "MateBook X Pro 12" + }, + { + "name": "SECTION_PRODUCTS_TITLES2", + "value": "New" + }, + { + "name": "SECTION_PRODUCTS_INFO1", + "value": "Beidou Msg | Low Batt Emergency" + }, + { + "name": "SECTION_PRODUCTS_INFO2", + "value": "144Hz Full-Screen Display" + }, + { + "name": "SECTION_PRODUCTS_INFO3", + "value": "32GB Mem | 13th Gen Core | Super Term" + }, + { + "name": "SECTION_PRODUCTS_FEATURES1", + "value": "V1-V5: ¥400 Off / 12M Int-Free" + }, + { + "name": "SECTION_PRODUCTS_FEATURES2", + "value": "Next-Gen Straight-Screen Flagship" + }, + { + "name": "SECTION_PRODUCTS_FEATURES3", + "value": "Up to ¥100 Off" + }, + { + "name": "SECTION_PRODUCTS_FEATURES4", + "value": "Ltd Time ¥300 Off" + }, + { + "name": "SECTION_PRODUCTS_FEATURES5", + "value": "Max ¥300 Off" + }, + { + "name": "SHOPPING_BAG_TITLES1", + "value": "Cart" + }, + { + "name": "SHOPPING_BAG_TITLES2", + "value": "Manage" + }, + { + "name": "SHOPPING_BAG_TITLES3", + "value": "Huawei official flagship store" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES1", + "value": "Select All" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES2", + "value": "Total:" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES3", + "value": "Discounted ¥1000" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES4", + "value": "Check out(1)" + }, + { + "name": "HOME_REVIEW", + "value": "2.57K Reviews, 95% Positive" + }, + { + "name": "Hot_Seller", + "value": "Hot Seller" + }, + { + "name": "New_Launch", + "value": "New Launch" + }, + { + "name": "SECTION_PRODUCTS_INFO4", + "value": "New Front 60MP Ultra-Wide Lens" + }, + { + "name": "SECTION_PRODUCTS_INFO5", + "value": "2.5K HR Screen | Lt, Thin, Long Batt Life" + }, + { + "name": "SECTION_PRODUCTS_INFO6", + "value": "Thin, Flat, Reliable" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES1", + "value": "Next-Gen Straight Flagship" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES2", + "value": "Points" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES3", + "value": "Ltd Time: 6M Int-Free" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES4", + "value": "V1-V5: ¥100 Off | Free Classic Headphones" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES5", + "value": "Pre-order Perf. Ed., Save ¥200" + }, + { + "name": "PRODUCT_NAME_LIST1", + "value": "HuaWei Mate 50 Pro 256GB Frosty Silver (Kunlun Glass)" + }, + { + "name": "PRODUCT_NAME_LIST2", + "value": "HuaWei Mate 60 12+1TB Yadan Black (Std Config)" + }, + { + "name": "PRODUCT_NAME_LIST3", + "value": "【In Stock】HUAWEI Mate X5 12+512GB Phantom Purple" + }, + { + "name": "PRODUCT_TYPE_LIST1", + "value": "Frosty Silver 256GB (Kunlun Glass), Std Config, Fast Shipping" + }, + { + "name": "PRODUCT_TYPE_LIS2", + "value": "Yadan Black 12+1TB, Std Config, Pre-order OK" + }, + { + "name": "PRODUCT_TYPE_LIST3", + "value": "Phantom Purple 512+12GB, Std Config, Fast Shipping" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE1", + "value": "0% Interest" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE2", + "value": "Ltd Time Offer" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE3", + "value": "Next-Gen Straight Flagship" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE4", + "value": "Points" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE1", + "value": "HUAWEI FreeLace Headphones …" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE2", + "value": "Mate 60 Ring Flash Case (Blk)" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE3", + "value": "Mate 50 Ring Flash Case (Silver)" + }, + { + "name": "PRODUCT_SERVICE_LIST_message", + "value": "Worry-Free Service" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE1", + "value": "total price" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE2", + "value": "coupon" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE3", + "value": "discount" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE4", + "value": "sum" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE5", + "value": "offer breakdown" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE6", + "value": "Actual discount shown at checkout." + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE7", + "value": "delivery" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE8", + "value": "indicate delivery" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE9", + "value": "E-Invoice for Individuals" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE10", + "value": "【gift】" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE11", + "value": "【serv】" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE12", + "value": "event offer" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/float.json b/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..4c8224722eea75f2643355d92d8a781b9ee809cb --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/float.json @@ -0,0 +1,928 @@ +{ + "float": [ + { + "name": "bottom_tab_bar_width_lg", + "value": "96vp" + }, + { + "name": "side_tab_bar_height", + "value": "80vp" + }, + { + "name": "tab_font_size", + "value": "10fp" + }, + { + "name": "tab_top_margin", + "value": "4vp" + }, + { + "name": "top_bar_text_selected_font", + "value": "24fp" + }, + { + "name": "top_bar_text_font", + "value": "18fp" + }, + { + "name": "top_bar_text_selected_line", + "value": "32vp" + }, + { + "name": "top_bar_text_line", + "value": "24vp" + }, + { + "name": "top_bar_text_font_sel", + "value": "24fp" + }, + { + "name": "top_bar_text_line_sel", + "value": "33vp" + }, + { + "name": "top_text_padding_left_sm", + "value": "8vp" + }, + { + "name": "top_text_padding_right_sm", + "value": "16vp" + }, + { + "name": "top_text_padding_right_md", + "value": "24vp" + }, + { + "name": "top_text_padding_right_lg", + "value": "32vp" + }, + { + "name": "search_input_font", + "value": "16fp" + }, + { + "name": "search_input_height", + "value": "40vp" + }, + { + "name": "search_input_left", + "value": "36vp" + }, + { + "name": "search_input_right", + "value": "12vp" + }, + { + "name": "search_img_size", + "value": "16vp" + }, + { + "name": "search_img_left", + "value": "12vp" + }, + { + "name": "search_img_margin_sm", + "value": "16vp" + }, + { + "name": "search_img_margin", + "value": "24vp" + }, + { + "name": "category_img_size_sm", + "value": "40vp" + }, + { + "name": "category_img_size_md", + "value": "64vp" + }, + { + "name": "category_img_size_lg", + "value": "68vp" + }, + { + "name": "category_text_font", + "value": "12fp" + }, + { + "name": "category_text_line", + "value": "17vp" + }, + { + "name": "category_item_height_sm", + "value": "57vp" + }, + { + "name": "category_item_height_md", + "value": "81vp" + }, + { + "name": "category_item_height_lg", + "value": "85vp" + }, + { + "name": "category_lanes_gutter", + "value": "12vp" + }, + { + "name": "category_list_height_sm", + "value": "126vp" + }, + { + "name": "category_list_height_md", + "value": "81vp" + }, + { + "name": "category_list_height_lg", + "value": "85vp" + }, + { + "name": "category_divider_width", + "value": "24vp" + }, + { + "name": "category_divider_row_height", + "value": "32vp" + }, + { + "name": "category_col_height_sm", + "value": "126vp" + }, + { + "name": "category_col_height_md", + "value": "113vp" + }, + { + "name": "category_col_height_lg", + "value": "117vp" + }, + { + "name": "category_col_margin", + "value": "12vp" + }, + { + "name": "category_col_margin_sm", + "value": "16vp" + }, + { + "name": "welfare_image_size_sm", + "value": "60vp" + }, + { + "name": "welfare_image_size", + "value": "72vp" + }, + { + "name": "title_font", + "value": "16fp" + }, + { + "name": "title_line", + "value": "22vp" + }, + { + "name": "button_height", + "value": "28vp" + }, + { + "name": "button_width", + "value": "80vp" + }, + { + "name": "button_font", + "value": "12fp" + }, + { + "name": "title_height", + "value": "48vp" + }, + { + "name": "welfare_tip_font", + "value": "10fp" + }, + { + "name": "welfare_tip_line", + "value": "16vp" + }, + { + "name": "welfare_tip_width", + "value": "40vp" + }, + { + "name": "welfare_info_font", + "value": "12fp" + }, + { + "name": "welfare_info_line", + "value": "16vp" + }, + { + "name": "welfare_info_margin", + "value": "4vp" + }, + { + "name": "welfare_row_height_sm", + "value": "102vp" + }, + { + "name": "welfare_row_height_md", + "value": "114vp" + }, + { + "name": "welfare_row_height_lg", + "value": "118vp" + }, + { + "name": "welfare_row_padding_sm", + "value": "16vp" + }, + { + "name": "welfare_row_padding_md", + "value": "12vp" + }, + { + "name": "welfare_row_padding_lg", + "value": "20vp" + }, + { + "name": "welfare_col_height_sm", + "value": "162vp" + }, + { + "name": "welfare_col_height_md", + "value": "174vp" + }, + { + "name": "welfare_col_height_lg", + "value": "178vp" + }, + { + "name": "welfare_col_padding", + "value": "12vp" + }, + { + "name": "title_tip_font", + "value": "14fp" + }, + { + "name": "title_tip_line", + "value": "19vp" + }, + { + "name": "recommend_swiper_top_sm", + "value": "24vp" + }, + { + "name": "recommend_swiper_bottom_md", + "value": "12vp" + }, + { + "name": "recommend_swiper_bottom", + "value": "16vp" + }, + { + "name": "title_view_padding", + "value": "12vp" + }, + { + "name": "section_gutter_sm", + "value": "10vp" + }, + { + "name": "section_gutter_md", + "value": "12vp" + }, + { + "name": "section_gutter_lg", + "value": "8vp" + }, + { + "name": "section_live_margin", + "value": "8vp" + }, + { + "name": "section_image_margin_sm", + "value": "12vp" + }, + { + "name": "section_image_margin", + "value": "8vp" + }, + { + "name": "section_tip_text_line", + "value": "12vp" + }, + { + "name": "section_tip_text_size", + "value": "8fp" + }, + { + "name": "section_tip_text_margin", + "value": "2vp" + }, + { + "name": "section_tip_text_padding", + "value": "4vp" + }, + { + "name": "section_title_text_size", + "value": "14fp" + }, + { + "name": "section_title_text_line", + "value": "19vp" + }, + { + "name": "section_info_text_size", + "value": "12fp" + }, + { + "name": "section_info_text_line", + "value": "16vp" + }, + { + "name": "section_info_text_margin", + "value": "2vp" + }, + { + "name": "section_price_text_size", + "value": "14fp" + }, + { + "name": "section_price_text_line", + "value": "19vp" + }, + { + "name": "section_price_text_margin", + "value": "10vp" + }, + { + "name": "original_price_text_size", + "value": "8fp" + }, + { + "name": "original_price_text_line", + "value": "10vp" + }, + { + "name": "original_price_text_margin", + "value": "4vp" + }, + { + "name": "section_feature_text_size", + "value": "9fp" + }, + { + "name": "section_feature_text_line", + "value": "12vp" + }, + { + "name": "section_feature_padding", + "value": "4vp" + }, + { + "name": "section_feature_margin_top", + "value": "6vp" + }, + { + "name": "section_feature_margin_left", + "value": "4vp" + }, + { + "name": "section_comments_text_size", + "value": "10fp" + }, + { + "name": "section_comments_text_line", + "value": "14vp" + }, + { + "name": "section_comments_text_top", + "value": "6vp" + }, + { + "name": "section_comments_text_bottom", + "value": "12vp" + }, + { + "name": "section_margin_md", + "value": "12vp" + }, + { + "name": "section_margin", + "value": "16vp" + }, + { + "name": "section_feature_border_width", + "value": "1vp" + }, + { + "name": "section_feature_border_radius", + "value": "4vp" + }, + { + "name": "flash_sale_margin_lg", + "value": "16vp" + }, + { + "name": "flash_sale_margin", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_sm", + "value": "0" + }, + { + "name": "flash_grid_gutter_x_md", + "value": "12vp" + }, + { + "name": "flash_grid_gutter_x_lg", + "value": "4vp" + }, + { + "name": "flash_grid_gutter_y", + "value": "12vp" + }, + { + "name": "flash_button_top", + "value": "8vp" + }, + { + "name": "flash_button_bottom", + "value": "12vp" + }, + { + "name": "flash_button_right", + "value": "8vp" + }, + { + "name": "flash_button_right_lg", + "value": "16vp" + }, + { + "name": "flash_row_margin", + "value": "12vp" + }, + { + "name": "classify_banner_height", + "value": "107vp" + }, + { + "name": "classify_swiper_indicator_width", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_height", + "value": "6vp" + }, + { + "name": "classify_swiper_indicator_selected_width", + "value": "12vp" + }, + { + "name": "classify_swiper_indicator_selected_height", + "value": "6vp" + }, + { + "name": "classify_swiper_next_margin_md", + "value": "13vp" + }, + { + "name": "classify_navigation_font_size", + "value": "14fp" + }, + { + "name": "classify_navigation_line_height", + "value": "19vp" + }, + { + "name": "classify_navigation_divider_height", + "value": "16vp" + }, + { + "name": "classify_navigation_bar_width_sm", + "value": "96vp" + }, + { + "name": "classify_navigation_bar_width_md", + "value": "144vp" + }, + { + "name": "classify_navigation_bar_width_lg", + "value": "200vp" + }, + { + "name": "classify_navigation_bar_height", + "value": "48vp" + }, + { + "name": "classify_header_input_font_size", + "value": "16fp" + }, + { + "name": "classify_header_input_height", + "value": "40vp" + }, + { + "name": "classify_header_input_padding_left", + "value": "36vp" + }, + { + "name": "classify_header_input_padding_right", + "value": "12vp" + }, + { + "name": "classify_header_input_search_size", + "value": "16vp" + }, + { + "name": "classify_header_input_search_margin", + "value": "16vp" + }, + { + "name": "classify_header_row_width", + "value": "328vp" + }, + { + "name": "classify_header_padding_left_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_header_padding", + "value": "24vp" + }, + { + "name": "classify_header_image_margin_sm", + "value": "16vp" + }, + { + "name": "classify_header_image_margin", + "value": "24vp" + }, + { + "name": "classify_banner_padding_right_sm", + "value": "16vp" + }, + { + "name": "classify_banner_padding_right_md", + "value": "0vp" + }, + { + "name": "classify_banner_padding_right_lg", + "value": "32vp" + }, + { + "name": "classify_destination_padding_top", + "value": "8vp" + }, + { + "name": "classify_destination_padding_left_sm", + "value": "4vp" + }, + { + "name": "classify_destination_padding_left", + "value": "0vp" + }, + { + "name": "classify_header_input_width", + "value": "232vp" + }, + { + "name": "shop_list_font", + "value": "16fp" + }, + { + "name": "shop_list_row_height", + "value": "48vp" + }, + { + "name": "list_name_font", + "value": "12fp" + }, + { + "name": "shop_grid_padding", + "value": "12vp" + }, + { + "name": "shop_col_padding_lg", + "value": "16vp" + }, + { + "name": "shop_col_padding", + "value": "12vp" + }, + { + "name": "shop_col_margin_lg", + "value": "16vp" + }, + { + "name": "shop_col_margin", + "value": "12vp" + }, + { + "name": "shop_list_margin", + "value": "12vp" + }, + { + "name": "bag_back_margin", + "value": "16vp" + }, + { + "name": "bag_title_font", + "value": "24fp" + }, + { + "name": "bag_name_font", + "value": "14fp" + }, + { + "name": "bag_close_margin", + "value": "24vp" + }, + { + "name": "bag_title_row_height", + "value": "56vp" + }, + { + "name": "bag_col_margin", + "value": "12vp" + }, + { + "name": "check_box_size", + "value": "18vp" + }, + { + "name": "check_box_group_margin", + "value": "12vp" + }, + { + "name": "bag_seller_logo_margin", + "value": "4vp" + }, + { + "name": "bag_seller_logo_border_width", + "value": "0.5vp" + }, + { + "name": "bag_card_title_row_height", + "value": "42vp" + }, + { + "name": "bag_card_check_box_margin", + "value": "14vp" + }, + { + "name": "bag_card_check_col_width", + "value": "32vp" + }, + { + "name": "bag_card_check_col_padding", + "value": "40vp" + }, + { + "name": "bag_card_row_padding", + "value": "12vp" + }, + { + "name": "bag_card_col_padding", + "value": "12vp" + }, + { + "name": "bag_discount_font_1", + "value": "20fp" + }, + { + "name": "bag_discount_font_2", + "value": "14fp" + }, + { + "name": "bag_discount_font_3", + "value": "16fp" + }, + { + "name": "bag_discount_line_1", + "value": "28vp" + }, + { + "name": "bag_discount_line_2", + "value": "19vp" + }, + { + "name": "bag_discount_line_3", + "value": "22vp" + }, + { + "name": "bag_discount_title_padding_top", + "value": "2vp" + }, + { + "name": "bag_discount_title_padding_bottom", + "value": "4vp" + }, + { + "name": "bag_discount_row_height", + "value": "48vp" + }, + { + "name": "bag_discount_padding", + "value": "12vp" + }, + { + "name": "bag_discount_margin", + "value": "16vp" + }, + { + "name": "bag_discount_col_padding_bottom", + "value": "12vp" + }, + { + "name": "shop_card_check_margin", + "value": "4vp" + }, + { + "name": "shop_card_font_1", + "value": "12fp" + }, + { + "name": "shop_card_font_2", + "value": "10vp" + }, + { + "name": "shop_card_font_3", + "value": "16fp" + }, + { + "name": "shop_card_line_1", + "value": "19vp" + }, + { + "name": "shop_card_line_2", + "value": "17vp" + }, + { + "name": "shop_card_line_3", + "value": "22vp" + }, + { + "name": "shop_card_line_4", + "value": "14vp" + }, + { + "name": "arrow_up_margin", + "value": "4vp" + }, + { + "name": "arrow_up_width", + "value": "8vp" + }, + { + "name": "arrow_up_height", + "value": "16vp" + }, + { + "name": "foot_button_height", + "value": "40vp" + }, + { + "name": "foot_button_width", + "value": "120vp" + }, + { + "name": "foot_button_margin", + "value": "8vp" + }, + { + "name": "foot_height", + "value": "56vp" + }, + { + "name": "foot_padding_more", + "value": "32vp" + }, + { + "name": "card_item_font_1", + "value": "13fp" + }, + { + "name": "card_item_font_2", + "value": "9fp" + }, + { + "name": "card_item_font_3", + "value": "12fp" + }, + { + "name": "card_item_font_4", + "value": "16fp" + }, + { + "name": "card_item_font_5", + "value": "10fp" + }, + { + "name": "card_item_font_6", + "value": "11fp" + }, + { + "name": "card_item_name_margin", + "value": "3vp" + }, + { + "name": "card_item_type_margin", + "value": "4vp" + }, + { + "name": "card_type_padding_row_top", + "value": "1vp" + }, + { + "name": "card_type_padding_row_left", + "value": "6vp" + }, + { + "name": "card_type_padding_row_right", + "value": "10vp" + }, + { + "name": "card_type_margin_row_bottom", + "value": "10vp" + }, + { + "name": "card_preferential_padding_top", + "value": "2vp" + }, + { + "name": "card_preferential_padding_left", + "value": "5vp" + }, + { + "name": "card_preferential_margin", + "value": "4vp" + }, + { + "name": "card_preferential_row_margin", + "value": "11vp" + }, + { + "name": "card_price_margin", + "value": "4vp" + }, + { + "name": "card_price_more_margin", + "value": "10vp" + }, + { + "name": "add_button_size", + "value": "24vp" + }, + { + "name": "add_button_border_width", + "value": "0.5vp" + }, + { + "name": "card_number_font", + "value": "13fp" + }, + { + "name": "card_number_width", + "value": "24vp" + }, + { + "name": "card_number_margin", + "value": "4vp" + }, + { + "name": "card_item_col_padding", + "value": "12vp" + }, + { + "name": "card_gift_width", + "value": "48vp" + }, + { + "name": "card_gift_row_margin_top", + "value": "4vp" + }, + { + "name": "card_gift_row_margin_bottom", + "value": "5vp" + }, + { + "name": "card_service_padding_left", + "value": "4vp" + }, + { + "name": "card_service_padding_top", + "value": "2vp" + }, + { + "name": "card_gift_row_padding", + "value": "42vp" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/string.json b/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be428e413f848afdbf338d66ca9aaa3b34c804c3 --- /dev/null +++ b/MultiShoppingPriceComparison/features/home/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,416 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "NAV_ROUTER_LIST1", + "value": "手机" + }, + { + "name": "NAV_ROUTER_LIST2", + "value": "穿戴" + }, + { + "name": "NAV_ROUTER_LIST3", + "value": "平板" + }, + { + "name": "NAV_ROUTER_LIST4", + "value": "笔记本" + }, + { + "name": "NAV_ROUTER_LIST5", + "value": "台显打印" + }, + { + "name": "NAV_ROUTER_LIST6", + "value": "耳机音响" + }, + { + "name": "NAV_ROUTER_LIST7", + "value": "智慧屏" + }, + { + "name": "NAV_ROUTER_LIST8", + "value": "门锁路由" + }, + { + "name": "NAV_ROUTER_LIST9", + "value": "出行车品" + }, + { + "name": "NAV_ROUTER_LIST10", + "value": "数码配件" + }, + { + "name": "NAV_ROUTER_LIST11", + "value": "华为服务" + }, + { + "name": "NAV_ROUTER_LIST12", + "value": "数字内容" + }, + { + "name": "NAV_ROUTER_LIST13", + "value": "商用终端" + }, + { + "name": "NAV_ROUTER_LIST14", + "value": "华为智选" + }, + { + "name": "NAV_ROUTER_LIST15", + "value": "家用电器" + }, + { + "name": "SHOP_TITLE_LIST1", + "value": "新品上市" + }, + { + "name": "SHOP_TITLE_LIST2", + "value": "HUAWEI Mate系列" + }, + { + "name": "SHOP_TITLE_LIST3", + "value": "HUAWEI P系列" + }, + { + "name": "search", + "value": "搜索" + }, + { + "name": "FOOTER_TOPIC_LIST1", + "value": "首页" + }, + { + "name": "FOOTER_TOPIC_LIST2", + "value": "分类" + }, + { + "name": "FOOTER_TOPIC_LIST3", + "value": "发现" + }, + { + "name": "FOOTER_TOPIC_LIST4", + "value": "购物袋" + }, + { + "name": "FOOTER_TOPIC_LIST5", + "value": "我的" + }, + { + "name": "TOP_BAR_TEXTS1", + "value": "华为" + }, + { + "name": "TOP_BAR_TEXTS2", + "value": "AITO汽车" + }, + { + "name": "TOP_BAR_TEXTS3", + "value": "华为智选" + }, + { + "name": "TOP_BAR_TEXTS4", + "value": "生态周边" + }, + { + "name": "searching", + "value": "搜索..." + }, + { + "name": "GOOD_CATEGORIES1", + "value": "智慧办公" + }, + { + "name": "GOOD_CATEGORIES3", + "value": "华为手机" + }, + { + "name": "GOOD_CATEGORIES2", + "value": "智慧家居" + }, + { + "name": "GOOD_CATEGORIES4", + "value": "影音娱乐" + }, + { + "name": "GOOD_CATEGORIES5", + "value": "运动健康" + }, + { + "name": "GOOD_CATEGORIES6", + "value": "AITO汽车" + }, + { + "name": "GOOD_CATEGORIES7", + "value": "华为智选" + }, + { + "name": "GOOD_CATEGORIES8", + "value": "鸿蒙智联" + }, + { + "name": "GOOD_CATEGORIES9", + "value": "企业商用" + }, + { + "name": "GOOD_CATEGORIES10", + "value": "全屋智能" + }, + { + "name": "PRICE_UNIT", + "value": "起" + }, + { + "name": "HOME_TITLES1", + "value": "福利专区" + }, + { + "name": "HOME_TITLES2", + "value": "甄选推荐" + }, + { + "name": "HOME_TITLES3", + "value": "限时秒杀" + }, + { + "name": "BUTTON_TEXTS1", + "value": "立即领券" + }, + { + "name": "BUTTON_TEXTS2", + "value": "立即购买" + }, + { + "name": "TIP_TEXTS1", + "value": "用券价" + }, + { + "name": "TIP_TEXTS2", + "value": "更多" + }, + { + "name": "TIP_TEXTS3", + "value": "新品" + }, + { + "name": "SECTION_PRODUCTS_TITLES1", + "value": "MateBook X Pro 12代" + }, + { + "name": "SECTION_PRODUCTS_TITLES2", + "value": "新品" + }, + { + "name": "SECTION_PRODUCTS_INFO1", + "value": "北斗卫星消息 | 低电量应急模式" + }, + { + "name": "SECTION_PRODUCTS_INFO2", + "value": "144Hz高割全面屏" + }, + { + "name": "SECTION_PRODUCTS_INFO3", + "value": "32GB大内存 | 13代酷睿处理器 | 超级终端" + }, + { + "name": "SECTION_PRODUCTS_FEATURES1", + "value": "V1-V5优惠400元/12期免息" + }, + { + "name": "SECTION_PRODUCTS_FEATURES2", + "value": "新一代直屏旗舰机" + }, + { + "name": "SECTION_PRODUCTS_FEATURES3", + "value": "最高省100" + }, + { + "name": "SECTION_PRODUCTS_FEATURES4", + "value": "限时直降300" + }, + { + "name": "SECTION_PRODUCTS_FEATURES5", + "value": "最高省300" + }, + { + "name": "SHOPPING_BAG_TITLES1", + "value": "购物袋" + }, + { + "name": "SHOPPING_BAG_TITLES2", + "value": "管理" + }, + { + "name": "SHOPPING_BAG_TITLES3", + "value": "华为官方旗舰店" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES1", + "value": "全选" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES2", + "value": "总计:" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES3", + "value": "已优惠 ¥1000" + }, + { + "name": "SHOPPING_CARD_FOOT_TITLES4", + "value": "领券结算(1)" + }, + { + "name": "HOME_REVIEW", + "value": "2571人评论 95%好评" + }, + { + "name": "Hot_Seller", + "value": "热品爆款" + }, + { + "name": "New_Launch", + "value": "新品上市" + }, + { + "name": "SECTION_PRODUCTS_INFO4", + "value": "前置6000万超广角镜头" + }, + { + "name": "SECTION_PRODUCTS_INFO5", + "value": "2.5K高刷护眼屏 | 轻薄长续航" + }, + { + "name": "SECTION_PRODUCTS_INFO6", + "value": "超轻薄|超平整|超可靠" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES1", + "value": "新一代直屏旗舰机" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES2", + "value": "赠积分" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES3", + "value": "限时享6期免息" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES4", + "value": "V1-V5优惠100 | 赠经典耳机" + }, + { + "name": "FLASH_SALE_PRODUCT_FEATURES5", + "value": "性能版新品预定立省200" + }, + { + "name": "PRODUCT_NAME_LIST1", + "value": "HUAWEI Mate 50 Pro 256GB 冰霜银(昆仑玻璃)" + }, + { + "name": "PRODUCT_NAME_LIST2", + "value": "HUAWEI Mate 60 12GB+1TB 雅丹黑(官方标配)" + }, + { + "name": "PRODUCT_NAME_LIST3", + "value": "【现货速发】HUAWEI Mate X5 12GB+512GB 幻影紫" + }, + { + "name": "PRODUCT_TYPE_LIST1", + "value": "冰霜银(昆仑玻璃)256GB 官方标配(含充电套装),现货速发" + }, + { + "name": "PRODUCT_TYPE_LIS2", + "value": "雅丹黑,12GB+1TB,官方标配(含充电套装),可提前预定" + }, + { + "name": "PRODUCT_TYPE_LIST3", + "value": "幻影紫,512GB+12GB,官方标配(含充电套装),现货速发" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE1", + "value": "0分期利息" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE2", + "value": "限时特惠" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE3", + "value": "新一代直屏旗舰机" + }, + { + "name": "PRODUCT_PREFERENTIALList_LIST_MESSAGE4", + "value": "赠积分" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE1", + "value": "HUAWEI FreeLace 无限耳机 …" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE2", + "value": "HUAWEI Mate 60 环闪保护壳(黑色)" + }, + { + "name": "PRODUCT_PRESENT_LIST_MESSAGE3", + "value": "HUAWEI Mate 50 环闪保护壳(银色)" + }, + { + "name": "PRODUCT_SERVICE_LIST_message", + "value": "无忧服务" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE1", + "value": "商品总价" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE12", + "value": "活动优惠" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE2", + "value": "优惠券" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE3", + "value": "共优惠" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE4", + "value": "合计" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE5", + "value": "优惠明细" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE6", + "value": "实际优惠金额请以下单页面为准" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE7", + "value": "配送" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE8", + "value": "标注配送" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE9", + "value": "电子普通发票-个人" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE10", + "value": "【赠品】" + }, + { + "name": "PREFERENCE_DETAILS_TITLE_MESSAGE11", + "value": "【服务】" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/hvigor/hvigor-config.json5 b/MultiShoppingPriceComparison/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 --- /dev/null +++ b/MultiShoppingPriceComparison/hvigor/hvigor-config.json5 @@ -0,0 +1,5 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/oh-package.json5 b/MultiShoppingPriceComparison/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..28d907b195f0457109ec1bc2aaa5bc9959260679 --- /dev/null +++ b/MultiShoppingPriceComparison/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + }, + "author": "", + "name": "multishoppingpricecomparison", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/build-profile.json5 b/MultiShoppingPriceComparison/products/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..14d5b832c7c04a429ed7da4c443d19c2566a4f25 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/build-profile.json5 @@ -0,0 +1,8 @@ +{ + "apiType": "stageMode", + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/hvigorfile.ts b/MultiShoppingPriceComparison/products/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiShoppingPriceComparison/products/phone/oh-package.json5 b/MultiShoppingPriceComparison/products/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..741122e9fa48e20702dfb3c8cc77c32051885ce6 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/oh-package.json5 @@ -0,0 +1,15 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/home": "file:../../features/home", + "@ohos/detail": "file:../../features/detail" + } +} diff --git a/MultiShoppingPriceComparison/products/phone/src/main/ets/entryability/EntryAbility.ets b/MultiShoppingPriceComparison/products/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0ff09dc03876f6bc104389ab476b07ed8ec2831 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { window } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { CommonConstants, WindowUtil } from '@ohos/commons'; + +export default class EntryAbility extends UIAbility { + private windowObj?: window.Window; + private windowUtil?: WindowUtil; + private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { + this.windowUtil?.updateBreakpoint(windowSize.width); + AppStorage.setOrCreate('windowWidth', windowSize.width); + }; + private onWindowStatusChange: (windowStatusType: window.WindowStatusType) => void = + (windowStatusType: window.WindowStatusType) => { + this.windowUtil?.updateWindowStatusType(windowStatusType); + }; + + onCreate(_want: Want, _launchParam: AbilityConstant.LaunchParam): void { + this.windowUtil = WindowUtil.getInstance(); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + async onWindowStageCreate(windowStage: window.WindowStage): Promise { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow().then((data: window.Window) => { + this.windowObj = data; + this.windowUtil?.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + AppStorage.setOrCreate('windowWidth', this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', this.onWindowSizeChange); + if (canIUse('SystemCapability.Window.SessionManager')) { + this.windowObj.on('windowStatusChange', this.onWindowStatusChange); + } + }) + AppStorage.setOrCreate('uiContext', this.context); + console.log(JSON.stringify(this.context) + '555555555555') + + if (this.windowUtil !== undefined) { + this.windowUtil.setWindowStage(windowStage); + await this.windowUtil.setMainWindow(); + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0]) { + this.windowUtil.setFullScreen(); + } + this.windowUtil.setAvoidRectHeight(); + } + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/ets/pages/Index.ets b/MultiShoppingPriceComparison/products/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb322ec839e619885e7072435a7d1030d23b47ec --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { window } from '@kit.ArkUI'; +import { CommonConstants, Logger, WindowUtil } from '@ohos/commons/Index'; +import { DetailConstants, ProductHome } from '@ohos/detail/Index'; +import { ProductMoreDetail } from '@ohos/detail/Index'; +import { LiveHome } from '@ohos/detail/Index'; +import { Home } from '@ohos/home/Index'; +import { ClassifyConstants } from '@ohos/home/Index'; + +@Entry +@Component +struct Index { + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @StorageLink('isSplitMode') isSplitMode: boolean = false; + private windowUtil?: WindowUtil; + private mainWindow?: window.Window; + + aboutToAppear(): void { + if (this.isSplitMode) { + this.pageInfos.pushPath({ name: ClassifyConstants.PAGE_INFO_LIST[2] }) + } + } + + aboutToDisappear(): void { + if (this.windowUtil === undefined) { + return; + } + this.mainWindow = this.windowUtil.getMainWindow(); + if (this.mainWindow === undefined) { + return; + } + try { + this.mainWindow.off('windowSizeChange'); + if (canIUse('SystemCapability.Window.SessionManager')) { + this.mainWindow.off('windowStatusChange'); + } + } catch (exception) { + Logger.error('Failed to unregister the window callback. Code: ' + JSON.stringify(exception)); + } + } + + @Builder + PageMap(name: string) { + if (name === ClassifyConstants.PAGE_INFO_LIST[0]) { + LiveHome() + } else if (name === ClassifyConstants.PAGE_INFO_LIST[1]) { + ProductMoreDetail() + } else { + ProductHome() + } + } + + build() { + Navigation(this.pageInfos) { + Home() + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .navDestination(this.PageMap) + .mode(NavigationMode.Stack) + .id(DetailConstants.NAVIGATION_ID) + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/ets/secondability/SecondAbility.ets b/MultiShoppingPriceComparison/products/phone/src/main/ets/secondability/SecondAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb4de71c22c5d3bcc7abb390c7b0841935076ec2 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/ets/secondability/SecondAbility.ets @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display, window } from '@kit.ArkUI'; +import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { CommonConstants, Logger, WindowUtil } from '@ohos/commons/Index'; + +export default class SecondAbility extends UIAbility { + private windowObj?: window.Window; + private windowUtil?: WindowUtil; + private mainWindow?: window.Window; + private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { + this.windowUtil?.updateBreakpoint(windowSize.width); + AppStorage.setOrCreate('windowWidth', windowSize.width); + }; + private onFoldStatusChange: (foldStatus: display.FoldStatus) => void = (foldStatus: display.FoldStatus) => { + if (canIUse('SystemCapability.Window.SessionManager')) { + let isSplitMode: boolean | undefined = AppStorage.get('isSplitMode'); + if (foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED && isSplitMode) { + this.context.terminateSelf(); + } + } + }; + + onCreate(_want: Want, _launchParam: AbilityConstant.LaunchParam): void { + this.windowUtil = WindowUtil.getSecondInstance(); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + if (canIUse('SystemCapability.Window.SessionManager')) { + display.off('foldStatusChange'); + } + if (this.windowUtil === undefined) { + return; + } + this.mainWindow = this.windowUtil.getMainWindow(); + if (this.mainWindow === undefined) { + return; + } + try { + this.mainWindow.off('windowSizeChange'); + } catch (exception) { + Logger.error('Failed to unregister the window callback. Code: ' + JSON.stringify(exception)); + } + } + + async onWindowStageCreate(windowStage: window.WindowStage): Promise { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow().then((data: window.Window) => { + this.windowObj = data; + this.windowUtil?.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + AppStorage.setOrCreate('windowWidth', this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', this.onWindowSizeChange); + }) + if (canIUse('SystemCapability.Window.SessionManager')) { + display.on(`foldStatusChange`, this.onFoldStatusChange); + } + AppStorage.setOrCreate('uiContext', this.context); + if (this.windowUtil !== undefined) { + this.windowUtil.setWindowStage(windowStage); + await this.windowUtil.setMainWindow(); + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPES[0]) { + this.windowUtil.setFullScreen(); + } + if (!AppStorage.get('topRectHeight')) { + this.windowUtil.setAvoidRectHeight(); + } + } + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/module.json5 b/MultiShoppingPriceComparison/products/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4df7da0736ca40ba14338bbd5bb3237e34c03f8b --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/module.json5 @@ -0,0 +1,53 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "minWindowWidth": 360, + "minWindowHeight": 600, + "launchType": "singleton", + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntry": "./ets/secondability/SecondAbility.ets", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 360, + "minWindowHeight": 600, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/color.json b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/string.json b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0210e391afb6d49db9e8d320dfbdf3f56aec4de4 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "Multi Shopping Price Comparison" + }, + { + "name": "SecondAbility_desc", + "value": "Split Screen - Offering Details" + }, + { + "name": "SecondAbility_label", + "value": "Split Screen - Offering Details" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/icon.png b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/startIcon.png b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/base/profile/main_pages.json b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/en_US/element/string.json b/MultiShoppingPriceComparison/products/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0210e391afb6d49db9e8d320dfbdf3f56aec4de4 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "Multi Shopping Price Comparison" + }, + { + "name": "SecondAbility_desc", + "value": "Split Screen - Offering Details" + }, + { + "name": "SecondAbility_label", + "value": "Split Screen - Offering Details" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/products/phone/src/main/resources/zh_CN/element/string.json b/MultiShoppingPriceComparison/products/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b8c558049acf2794659bedca6e0f1bc74ffa3ca7 --- /dev/null +++ b/MultiShoppingPriceComparison/products/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "一多开发实例-购物比价" + }, + { + "name": "SecondAbility_desc", + "value": "分屏-商品详情" + }, + { + "name": "SecondAbility_label", + "value": "分屏-商品详情" + } + ] +} \ No newline at end of file diff --git a/MultiShoppingPriceComparison/screenshots/device/foldable.en.png b/MultiShoppingPriceComparison/screenshots/device/foldable.en.png new file mode 100644 index 0000000000000000000000000000000000000000..9b94a3754ddd43e1d4bd2fc0a89ac643b68d426e Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/foldable.en.png differ diff --git a/MultiShoppingPriceComparison/screenshots/device/foldable.png b/MultiShoppingPriceComparison/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..115dff5dec6d064ebf5c484b652d68fb8b86a8ff Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/foldable.png differ diff --git a/MultiShoppingPriceComparison/screenshots/device/phone.en.png b/MultiShoppingPriceComparison/screenshots/device/phone.en.png new file mode 100644 index 0000000000000000000000000000000000000000..43788a0a78cb6a25aed837d039ec18a8d71277f6 Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/phone.en.png differ diff --git a/MultiShoppingPriceComparison/screenshots/device/phone.png b/MultiShoppingPriceComparison/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..c5d1288e8853e7dd87e0f7023710c76315d18a63 Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/phone.png differ diff --git a/MultiShoppingPriceComparison/screenshots/device/tablet.en.png b/MultiShoppingPriceComparison/screenshots/device/tablet.en.png new file mode 100644 index 0000000000000000000000000000000000000000..9b60026bd99b5050ea73233f30e81e4739f487c4 Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/tablet.en.png differ diff --git a/MultiShoppingPriceComparison/screenshots/device/tablet.png b/MultiShoppingPriceComparison/screenshots/device/tablet.png new file mode 100644 index 0000000000000000000000000000000000000000..fd121b6beedfa608e0739bdb6b8349e5164883a3 Binary files /dev/null and b/MultiShoppingPriceComparison/screenshots/device/tablet.png differ diff --git a/MultiVideoApplication/AppScope/app.json5 b/MultiVideoApplication/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d83b0ce7bce053e0f9e68362a113ef75c12f6a58 --- /dev/null +++ b/MultiVideoApplication/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.videoapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/MultiVideoApplication/AppScope/resources/base/element/string.json b/MultiVideoApplication/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6cad906ce541f191caab019640a63c6229aba330 --- /dev/null +++ b/MultiVideoApplication/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiVideoApplication" + } + ] +} diff --git a/MultiVideoApplication/AppScope/resources/base/media/app_icon.png b/MultiVideoApplication/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiVideoApplication/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiVideoApplication/AppScope/resources/base/media/background.png b/MultiVideoApplication/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/MultiVideoApplication/AppScope/resources/base/media/background.png differ diff --git a/MultiVideoApplication/AppScope/resources/base/media/foreground.png b/MultiVideoApplication/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/MultiVideoApplication/AppScope/resources/base/media/foreground.png differ diff --git a/MultiVideoApplication/AppScope/resources/base/media/layered_image.json b/MultiVideoApplication/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/MultiVideoApplication/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/MultiVideoApplication/LICENSE b/MultiVideoApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/MultiVideoApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + + 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/MultiVideoApplication/README.en.md b/MultiVideoApplication/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..6327e3fd8940d82b0af836cbef1b49422b776aac --- /dev/null +++ b/MultiVideoApplication/README.en.md @@ -0,0 +1,48 @@ +# Long Video + +### Introduction + +This codelab implements a short video app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment. It uses the three-layer project architecture for code reuse and tailors the pages to different device sizes such as mobile phones, foldable phones, tablets, and PC/2-in-1 devices. + +The figure shows the effect on the mobile phone: + +![](screenshots/device/phone_EN.png) + +The figure shows the effect on the foldable phone: + +![](screenshots/device/foldable_EN.jpg) + +The figure shows the effect on the tablet and PC/2-in-1 device: + +![](screenshots/device/tablet_EN.png) + +### Concepts + +- One-time development for multi-device deployment: You only need to develop and release one set of project code and then deploy it on multiple devices as demanded. This feature enables you to efficiently develop applications that are compatible with multiple devices while providing distributed user experiences for cross-device transferring, migration, and collaboration. +- Adaptive layout: When the size of an external container changes, elements can automatically change based on the relative relationship to adapt to the external container. Relative relationships include the proportion, fixed aspect ratio, and display priority. +- Responsive layout: When the size of an external container changes, elements can automatically change based on the breakpoints, grids, or specific features (such as the screen direction and window width and height) to adapt to the external container. +- GridRow: A container that is used in a grid layout, together with its child component **GridCol**. +- GridCol: A container that must be used as a child component of the **GridRow** container. +- Using the AVPlayer for audio playback: The AVPlayer can be used to play raw media assets in an end-to-end manner. + +### Permissions + +N/A. + +### How to Use + +1. Install and open an app on a mobile phone, foldable phone, or tablet. The responsive layout and adaptive layout are used to display different effects on the app pages over different devices. +2. Swipe up or down the home page content and swipe left or right banners and icon lists. +3. Touch and hold the first image in the recommended video area to preview the video. Right-click the recommended video area and a menu is displayed. Hover the mouse pointer over the recommended video area to zoom in the image. Pinch two fingers to zoom in or out the video area on a PC/2-in-1 device or foldable phone. +4. Switch to the community tab on the top to view the immersive design of the home page. Switch to the video tab on the top to view the innovative layout of the banner images on a PC/2-in-1 device. +5. Click the search box on the top to display the search page. Enter "Hua" in the search box and the intelligent prompt page is displayed. Click "Huawei launch event" in the intelligent prompts. The search result page is displayed. Click the Play button in the search result. The video details page is displayed. +6. By default, the video is played on the video details page. Click the video to play or pause it, and click or drag the progress bar to seek to the playback position. +7. When you swipe up on a phone or foldable phone, the related list is hidden, the video is zoomed out proportionally, and the comment area is swiped. When you swipe up on a PC/2-in-1 device, the video is zoomed out proportionally and the introduction area is swiped. Click the full-screen button in the video area to access the full-screen playback page. +8. Play a video in full-screen mode and click the Play/Pause button to play or pause the video. Click the episode selection button. The episode selection toolbar is displayed. + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. +2. HarmonyOS: HarmonyOS 5.0.0 Release or later +3. DevEco Studio: DevEco Studio 5.0.0 Release or later +4. HarmonyOS SDK: HarmonyOS 5.0.0 Release SDK or later diff --git a/MultiVideoApplication/README.md b/MultiVideoApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..609ab1ca2c8453039b2165eb5d5e060ae7c7ef6e --- /dev/null +++ b/MultiVideoApplication/README.md @@ -0,0 +1,48 @@ +# 一多开发实例-长视频 + +### 简介 + +本篇Codelab基于自适应布局和响应式布局,实现一次开发,多端部署的长视频页面。通过“三层工程架构”实现代码复用,并根据手机、折叠屏、平板以及PC/2in1不同的设备尺寸实现对应页面。 + +手机运行效果图如下: + +![](screenshots/device/phone.png) + +折叠屏运行效果图如下: + +![](screenshots/device/foldable.png) + +平板、PC/2in1运行效果图如下: + +![](screenshots/device/tablet.png) + +### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 自适应布局:当外部容器大小发生变化时,元素可以根据相对关系自动变化以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。 +- 响应式布局:当外部容器大小发生变化时,元素可以根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化以适应外部容器变化的布局能力。 +- GridRow:栅格容器组件,仅可以和栅格子组件(GridCol)在栅格布局场景中使用。 +- GridCol:栅格子组件,必须作为栅格容器组件(GridRow)的子组件使用。 +- 使用AVPlayer开发音频播放:使用AVPlayer可以实现端到端播放原始媒体资源。 + +### 相关权限 + +不涉及。 + +### 使用说明 + +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 首页内容,支持上下滑动,Banner左右滑动,图标列表左右滑动。 +3. 长按推荐视频区域的第一张图片,能够预览视频。鼠标右键点击推荐视频区域,弹出菜单。鼠标悬停在推荐视频区域,图片放大。PC/2in1和折叠屏设备,两指捏合推荐视频区能够缩放或放大。 +4. 切换顶部的社区tab,查看首页的沉浸式设计。PC/2in1设备,切换顶部的视频tab,查看Banner图的创新排版。 +5. 点击顶部的搜索框,展示搜索页内容。 搜索框输入“华”,出现智能提示页面。点击智能提示中的“华为发布会”,出现搜索结果页面。点击搜索结果中的播放按钮,进入视频详情页。 +6. 视频详情页默认播放视频,点击视频进行播放/暂停,点击/拖动进度条能够跳转播放。 +7. 手机/折叠屏上滑时,相关列表先隐藏,视频再等比缩小,然后滑动评论区;PC/2in1上滑时,视频等比缩小,然后滑动简介区。点击视频区域的全屏按钮,进入全屏播放页。 +8. 全屏播放视频,点击播放/暂停按钮,控制视频播放/暂停。点击选集按钮,显示选集工具栏。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 diff --git a/MultiVideoApplication/build-profile.json5 b/MultiVideoApplication/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..822b9737ebba8cbb0917779d8aee251ef502aad9 --- /dev/null +++ b/MultiVideoApplication/build-profile.json5 @@ -0,0 +1,83 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./products/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "home", + "srcPath": "./features/home", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "search", + "srcPath": "./features/search", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "videoDetail", + "srcPath": "./features/videoDetail", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./commons/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/Index.ets b/MultiVideoApplication/commons/base/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..07abac6905bccb771f74e699693e36c9969f09d7 --- /dev/null +++ b/MultiVideoApplication/commons/base/Index.ets @@ -0,0 +1,9 @@ +export { BreakpointConstants } from './src/main/ets/constants/BreakpointConstants'; +export { CommonConstants } from './src/main/ets/constants/CommonConstants'; +export { BreakpointType } from './src/main/ets/utils/BreakpointType'; +export { WindowUtil } from './src/main/ets/utils/WindowUtil'; +export { AvPlayerUtil } from './src/main/ets/utils/AvPlayerUtil'; +export { DisplayUtil } from './src/main/ets/utils/DisplayUtil'; +export { DeviceScreen } from './src/main/ets/utils/DeviceScreen'; +export { VideoNavPathStack } from './src/main/ets/utils/VideoNavPathStack'; +export { default as Logger } from './src//main/ets/utils/Logger'; \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/build-profile.json5 b/MultiVideoApplication/commons/base/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3167e54d1ff3a0aaa0cdcf4319789de8e3f3c350 --- /dev/null +++ b/MultiVideoApplication/commons/base/build-profile.json5 @@ -0,0 +1,10 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/hvigorfile.ts b/MultiVideoApplication/commons/base/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiVideoApplication/commons/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiVideoApplication/commons/base/oh-package.json5 b/MultiVideoApplication/commons/base/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c764a93a96ab677a53c95087b3858bd0524e4e76 --- /dev/null +++ b/MultiVideoApplication/commons/base/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/MultiVideoApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets b/MultiVideoApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..8727d8f517dd24955fc96825c36d9f72bb3b8a4d --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [12, 15, 4]; + + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [12, 6, 7, 5, 3, 4, 2]; + + /** + * Breakpoint ranges. + */ + static readonly BREAKPOINT_RANGES: number[] = [320, 600, 840]; +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/constants/CommonConstants.ets b/MultiVideoApplication/commons/base/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e29116ccee0f65c4eb8688da37fb0c3b72b1dab --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Common constants for all features. + */ +export class CommonConstants { + /** + * Idle state of avPlayer. + */ + static readonly AV_PLAYER_IDLE_STATE: string = 'idle'; + + /** + * Initialized state of avPlayer. + */ + static readonly AV_PLAYER_INITIALIZED_STATE: string = 'initialized'; + + /** + * Prepared state of avPlayer. + */ + static readonly AV_PLAYER_PREPARED_STATE: string = 'prepared'; + + /** + * Playing state of avPlayer. + */ + static readonly AV_PLAYER_PLAYING_STATE: string = 'playing'; + + /** + * Pause state of avPlayer. + */ + static readonly AV_PLAYER_PAUSED_STATE: string = 'paused'; + + /** + * Completed state of avPlayer. + */ + static readonly AV_PLAYER_COMPLETED_STATE: string = 'completed'; + + /** + * Stopped state of avPlayer. + */ + static readonly AV_PLAYER_STOPPED_STATE: string = 'stopped'; + + /** + * Release state of avPlayer. + */ + static readonly AV_PLAYER_RELEASE_STATE: string = 'released'; + + /** + * Error state of avPlayer. + */ + static readonly AV_PLAYER_ERROR_STATE: string = 'error'; + + /** + * Product video name. + */ + static readonly PRODUCT_VIDEO_NAME: string = 'product.mp4'; + + /** + * Update time of av player. + */ + static readonly AV_PLAYER_UPDATE_TIME: string = 'updateTime'; + + /** + * Current time of av player. + */ + static readonly AV_PLAYER_CURRENT_TIME: string = 'currentTime'; + + /** + * Total time of av player. + */ + static readonly AV_PLAYER_TOTAL_TIME: string = 'totalTime'; + + /** + * Progress of av player. + */ + static readonly AV_PLAYER_PROGRESS: string = 'progress'; + + /** + * Initial time. + */ + static readonly INITIAL_TIME: string = '00:00:00'; + + /** + * List space. + */ + static readonly LIST_SPACE: string = '12vp'; + + /** + * Video grid column list. + */ + static readonly VIDEO_GRID_COLUMNS: string[] = ['1fr 1fr', '1fr 1fr 1fr', '1fr 1fr 1fr 1fr', '1fr 1fr 1fr 1fr 1fr', + '1fr 1fr 1fr 1fr 1fr 1fr 1fr']; + + /** + * colon. + */ + static readonly COLON: string = ':'; + + /** + * Time prefix. + */ + static readonly TIME_PREFIX: string = '0'; + + /** + * Empty time. + */ + static readonly EMPTY_TIME: string = '00'; + + /** + * Window util. + */ + static readonly WINDOW_UTIL: string = 'windowUtil'; + + /** + * Full percent. + */ + static readonly FULL_PERCENT: string = '100%'; + + /** + * One hundred for progress. + */ + static readonly PROGRESS_HUNDRED: number = 100; + + /** + * One thousand for progress. + */ + static readonly PROGRESS_THOUSAND: number = 1000; + + /** + * Second in hour. + */ + static readonly SECOND_IN_HOUR: number = 3600; + + /** + * Second in minute. + */ + static readonly SECOND_IN_MINUTE: number = 60; + + /** + * Zero. + */ + static readonly ZERO: number = 0; + + /** + * One. + */ + static readonly ONE: number = 1; + + /** + * Three. + */ + static readonly THREE: number = 3; + + /** + * FOUR. + */ + static readonly FOUR: number = 4; + + /** + * Ten. + */ + static readonly TEN: number = 10; + + /** + * Constant for screen dpi. + */ + static readonly SCREEN_DPI_CONSTANT: number = 160; + + /** + * Font weight 500. + */ + static readonly FONT_WEIGHT_500: number = 500; + + /** + * Font weight 700. + */ + static readonly FONT_WEIGHT_700: number = 700; + + /** + * Text opacity. + */ + static readonly TEXT_OPACITY: number[] = [0.4, 0.5, 0.6, 1, 0.8]; + + /** + * Divider opacity. + */ + static readonly DIVIDER_OPACITY: number = 0.05; + + /** + * X component surface width. + */ + static readonly X_COMPONENT_SURFACE_WIDTH: number = 1920; + + /** + * X component surface height. + */ + static readonly X_COMPONENT_SURFACE_HEIGHT: number = 1080; + + /** + * Video aspect ratio. + */ + static readonly VIDEO_ASPECT_RATIO: number = 1.78; + + /** + * Previous one row aspect ratio. + */ + static readonly PREVIOUS_ONE_ROW_RATIO: number = 1.56; + + /** + * Default window width. + */ + static readonly DEFAULT_WINDOW_WIDTH: number = 320; + + /** + * Device types. + */ + static readonly DEVICE_TYPE: string = '2in1'; + + /** + * Margin of window floating. + */ + static readonly WINDOW_FLOATING_MARGIN: number = 5.2; + + /** + * Page names. + */ + static readonly PAGE_NAMES: string[] = ['home', 'videoDetail']; +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/AvPlayerUtil.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/AvPlayerUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbbe6f116d8cda1234cb4103aaa79979ab5ccc0c --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/AvPlayerUtil.ets @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { media } from '@kit.MediaKit'; +import { common } from '@kit.AbilityKit'; +import { resourceManager } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import Logger from './Logger'; +import { CommonConstants } from '../constants/CommonConstants'; + +export class AvPlayerUtil { + private avPlayer?: media.AVPlayer; + private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; + private url: resourceManager.RawFileDescriptor | null = null; + private surfaceId: string = ''; + private sliderBegin: number = 0; + private isMoving: boolean = false; + private onError: (err: BusinessError) => void = (err: BusinessError) => { + Logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer?.reset(); + }; + private onTimeUpdateFunction: (updateTime: number) => void = (updateTime: number) => { + AppStorage.setOrCreate(CommonConstants.AV_PLAYER_CURRENT_TIME, this.formatTime(updateTime)); + AppStorage.setOrCreate(CommonConstants.AV_PLAYER_UPDATE_TIME, updateTime); + AppStorage.setOrCreate(CommonConstants.AV_PLAYER_PROGRESS, updateTime / this.avPlayer!.duration * + CommonConstants.PROGRESS_HUNDRED); + }; + private onStateChange: (state: media.AVPlayerState) => void = async (state: media.AVPlayerState) => { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + switch (state) { + case CommonConstants.AV_PLAYER_IDLE_STATE: + this.url = await this.context.resourceManager.getRawFd(CommonConstants.PRODUCT_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + Logger.info('AVPlayer state idle called.'); + break; + case CommonConstants.AV_PLAYER_INITIALIZED_STATE: + Logger.info('AVPlayer initialized called.'); + this.avPlayer.surfaceId = this.surfaceId; + this.avPlayer.prepare().then(() => { + Logger.info('AVPlayer prepare succeeded.'); + }, (err: BusinessError) => { + Logger.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer!.reset(); + }); + break; + case CommonConstants.AV_PLAYER_PREPARED_STATE: + this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; + Logger.info('AVPlayer state prepared called.'); + this.avPlayer.play(); + AppStorage.setOrCreate(CommonConstants.AV_PLAYER_TOTAL_TIME, this.formatTime(this.avPlayer.duration)); + break; + case CommonConstants.AV_PLAYER_PLAYING_STATE: + Logger.info('AVPlayer state playing called.'); + AppStorage.setOrCreate('avplayerState', this.avPlayer.state); + break; + case CommonConstants.AV_PLAYER_PAUSED_STATE: + Logger.info('AVPlayer state paused called.'); + AppStorage.setOrCreate('avplayerState', this.avPlayer.state); + break; + case CommonConstants.AV_PLAYER_COMPLETED_STATE: + Logger.info('AVPlayer state completed called.'); + AppStorage.setOrCreate('avplayerState', this.avPlayer.state); + this.avPlayer.stop(); + break; + case CommonConstants.AV_PLAYER_STOPPED_STATE: + Logger.info('AVPlayer state stopped called.'); + break; + case CommonConstants.AV_PLAYER_RELEASE_STATE: + Logger.info('AVPlayer state released called.'); + break; + case CommonConstants.AV_PLAYER_ERROR_STATE: + Logger.error('AVPlayer state error called.'); + break; + default: + Logger.info('AVPlayer state unknown called.'); + break; + } + }; + + static getInstance(): AvPlayerUtil | undefined { + if (!AppStorage.get('avPlayerUtil')) { + AppStorage.setOrCreate('avPlayerUtil', new AvPlayerUtil()); + } else { + Logger.info(`AppStorage does not have avPlayerUtil`); + } + return AppStorage.get('avPlayerUtil'); + } + + async createAvPlayer(surfaceId: string): Promise { + if (!this.avPlayer || this.avPlayer.state === CommonConstants.AV_PLAYER_RELEASE_STATE) { + this.avPlayer = await media.createAVPlayer(); + this.surfaceId = surfaceId; + Logger.info('Created AvPlayer successfully.'); + // Entering idle state. + this.url = await this.context.resourceManager.getRawFd(CommonConstants.PRODUCT_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + this.setAVPlayerCallback(); + } else { + Logger.info(`AvPlayer has been created`); + } + } + + setAVPlayerCallback(): void { + this.avPlayer?.on('error', this.onError); + this.onTimeUpdate(); + this.setStateChange(); + } + + onTimeUpdate(): void { + this.avPlayer?.on('timeUpdate', this.onTimeUpdateFunction); + } + + offTimeUpdate(): void { + try { + this.avPlayer?.off('timeUpdate'); + } catch (exception) { + Logger.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); + } + } + + setStateChange(): void { + this.avPlayer?.on('stateChange', this.onStateChange); + } + + release(): void { + if (this.avPlayer && this.avPlayer.state !== CommonConstants.AV_PLAYER_RELEASE_STATE) { + try { + this.avPlayer.off('error'); + this.avPlayer.off('stateChange'); + } catch (exception) { + Logger.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); + } + this.avPlayer.release(); + } else { + Logger.info(`AvPlayer release failed`); + } + } + + sliderChange(value: number, mode: SliderChangeMode): void { + let seekType: media.SeekMode = value > this.sliderBegin ? media.SeekMode.SEEK_PREV_SYNC : + media.SeekMode.SEEK_NEXT_SYNC; + switch (mode) { + case SliderChangeMode.Begin: + Logger.info(`AvPlayer SliderChangeMode Begin`); + this.sliderBegin = value; + this.avPlayer?.pause(); + break; + case SliderChangeMode.Moving: + Logger.info(`AvPlayer SliderChangeMode Moving`); + this.isMoving = true; + break; + case SliderChangeMode.End: + Logger.info(`AvPlayer SliderChangeMode End`); + if (this.isMoving) { + this.avPlayer?.seek(value / CommonConstants.PROGRESS_HUNDRED * this.avPlayer.duration, seekType); + this.isMoving = false; + } + this.avPlayer?.play(); + break; + case SliderChangeMode.Click: + Logger.info(`AvPlayer SliderChangeMode Click`); + this.avPlayer?.seek(this.sliderBegin / CommonConstants.PROGRESS_HUNDRED * this.avPlayer.duration, seekType); + break; + default: + break; + } + } + + playerStateControl(): void { + if (this.avPlayer?.state === CommonConstants.AV_PLAYER_STOPPED_STATE) { + this.avPlayer.prepare(); + } else if (this.avPlayer?.state === CommonConstants.AV_PLAYER_PAUSED_STATE) { + this.avPlayer.play(); + } else if (this.avPlayer?.state === CommonConstants.AV_PLAYER_PLAYING_STATE) { + this.avPlayer.pause(); + } + } + + fastForward(): void { + if (this.avPlayer?.state === CommonConstants.AV_PLAYER_PLAYING_STATE || this.avPlayer?.state === + CommonConstants.AV_PLAYER_PAUSED_STATE) { + this.avPlayer.seek(this.avPlayer.currentTime + 5000); + } + } + + rewind(): void { + if (this.avPlayer?.state === CommonConstants.AV_PLAYER_PLAYING_STATE || this.avPlayer?.state === + CommonConstants.AV_PLAYER_PAUSED_STATE) { + this.avPlayer.seek(this.avPlayer.currentTime - 5000); + } + } + + formatTime(duration: number): string { + let totalSecond: number = Math.round(duration / CommonConstants.PROGRESS_THOUSAND); + let hourNum: number = Math.floor(totalSecond / CommonConstants.SECOND_IN_HOUR); + let minNum: number = Math.floor((totalSecond % CommonConstants.SECOND_IN_HOUR) / CommonConstants.SECOND_IN_MINUTE); + let secNum: number = (totalSecond % CommonConstants.SECOND_IN_HOUR) % CommonConstants.SECOND_IN_MINUTE; + return this.formatUnitTime(hourNum) + CommonConstants.COLON + this.formatUnitTime(minNum) + CommonConstants.COLON + + this.formatUnitTime(secNum); + } + + formatUnitTime(time: number): string { + if (time >= CommonConstants.ONE && time < CommonConstants.TEN) { + let zero: string = CommonConstants.TIME_PREFIX; + return zero.concat(time.toString()); + } else if (time >= CommonConstants.ZERO && time < CommonConstants.ONE) { + return CommonConstants.EMPTY_TIME; + } + return time.toString(); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/BreakpointType.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/BreakpointType.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddaf75215a3602bba462784575b57871386d141b --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/BreakpointType.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '../constants/BreakpointConstants'; +// [Start breakpoint_type] +export class BreakpointType { + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + getValue(currentWidthBreakpoint: string): T { + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} +// [End breakpoint_type] \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/DeviceScreen.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/DeviceScreen.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b5a27b4757534febd89f5d09cc71703f31ee326 --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/DeviceScreen.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { CommonConstants } from '../constants/CommonConstants'; + +export class DeviceScreen { + /** + * Get the screen height. + * + * @returns screen height. + */ + public static getDeviceHeight(): number { + let displayObject = display.getDefaultDisplaySync(); + let screenPixelHeight = displayObject.height; + let screenDensityDPI = displayObject.densityDPI; + return screenPixelHeight * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI); + } + + /** + * Get the screen width. + * + * @returns screen width. + */ + public static getDeviceWidth(): number { + let displayObject = display.getDefaultDisplaySync(); + let screenPixelWidth = displayObject.width; + let screenDensityDPI = displayObject.densityDPI; + return screenPixelWidth * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/DisplayUtil.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/DisplayUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9eaa7589eb1bdcf1a25e77b32f0575025fa93b0 --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/DisplayUtil.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +// [Start display_util] +export class DisplayUtil { + static getFoldCreaseRegion(): void { + if(canIUse('SystemCapability.Window.SessionManager')) { + if (display.isFoldable()) { + let foldRegion: display.FoldCreaseRegion = display.getCurrentFoldCreaseRegion(); + let rect: display.Rect = foldRegion.creaseRects[0]; + // Height of the avoidance area in the upper half screen and height of the avoidance area. + let creaseRegion: number[] = [px2vp(rect.top), px2vp(rect.height)]; + AppStorage.setOrCreate('creaseRegion', creaseRegion); + } + } + } +} +// [End display_util] \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/Logger.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..4801a0b95063322e58bf6076f3fe5c7f30894f30 --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/Logger.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + /** + * constructor. + * + * @param Prefix Identifies the log tag. + * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. + */ + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('VideoApplication'); \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/VideoNavPathStack.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/VideoNavPathStack.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ceb4d36cb3f8abc17bf981768a05a6192e241e8 --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/VideoNavPathStack.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CommonConstants } from '../constants/CommonConstants'; + +export class VideoNavPathStack extends NavPathStack { + private pageName: string = CommonConstants.PAGE_NAMES[0]; + + setPageName(name: string): void { + this.pageName = name; + } + + getPageName(): string { + return this.pageName; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/ets/utils/WindowUtil.ets b/MultiVideoApplication/commons/base/src/main/ets/utils/WindowUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cc8b2dc65c9d1cf716a3868cab7260d61ea12b1 --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/ets/utils/WindowUtil.ets @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; +import { display, window } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { CommonConstants } from '../constants/CommonConstants'; + +@Observed +export class WindowUtil { + private windowStage?: window.WindowStage; + private mainWindowClass?: window.Window; + + static getInstance(): WindowUtil | undefined { + if (!AppStorage.get(CommonConstants.WINDOW_UTIL)) { + AppStorage.setOrCreate(CommonConstants.WINDOW_UTIL, new WindowUtil()); + } else { + hilog.info(0x0000, 'testTag', '%{public}s', `AppStorage does not have windowUtil.`); + } + return AppStorage.get(CommonConstants.WINDOW_UTIL); + } + + setWindowStage(windowStage: window.WindowStage): void { + this.windowStage = windowStage; + this.windowStage.getMainWindow((err, windowClass: window.Window) => { + this.mainWindowClass = windowClass; + if (err.code) { + hilog.error(0x0000, 'testTag', `Failed to obtain the main window. Code:${err.code}, message:${err.message}`, + JSON.stringify(err) ?? ''); + return; + } + }); + } + + setMainWindowOrientation(orientation: window.Orientation): void { + // Setting orientation. + this.mainWindowClass!.setPreferredOrientation(orientation) + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in setting the orientation.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', `Failed to set the orientation. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + + disableWindowSystemBar(): void { + // Set the status bar and navigation bar to be invisible in full-screen mode. + this.mainWindowClass!.setWindowSystemBarEnable([]) + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in setting the window system bar disable.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', + `Failed to set the window system bar disable. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + + enableWindowSystemBar(): void { + this.mainWindowClass!.setWindowSystemBarEnable(['status', 'navigation']) + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in setting the window system bar enable.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', `Failed to set the orientation. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + + setFullScreen(): void { + // Set full-screen display. + this.mainWindowClass!.setWindowLayoutFullScreen(true) + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in setting the window layout full screen.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', + `Failed to set the window layout full screen. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + + maximize(): void { + if(canIUse('SystemCapability.Window.SessionManager')){ + if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FLOATING) { + this.mainWindowClass!.maximize() + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in maximizing the window.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', `Failed to maximize the window. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + } + } + + recover(): void { + if(canIUse('SystemCapability.Window.SessionManager')){ + if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FULL_SCREEN) { + this.mainWindowClass!.recover() + .then(() => { + hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in rovering the window.`); + }) + .catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', `Failed to rover the window. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + }); + } + } + } + + getMainWindow(): window.Window | undefined { + return this.mainWindowClass; + } + + offWindowSizeChange(): void { + try { + this.mainWindowClass!.off('windowSizeChange'); + } catch (err) { + hilog.error(0x0000, 'testTag', `Failed to off window size change. Code: ${err.code}, message: ${err.message}`, + JSON.stringify(err) ?? ''); + } + } + // [Start update_width_bp] + updateWidthBp(): void { + let mainWindow: window.WindowProperties = this.mainWindowClass!.getWindowProperties(); + let windowWidth: number = mainWindow.windowRect.width; + let windowWidthVp = windowWidth / (display.getDefaultDisplaySync().densityDPI / 160); + if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE) { + windowWidthVp -= 2 * CommonConstants.WINDOW_FLOATING_MARGIN; + } + let widthBp: string = ''; + let videoGridColumn: string = CommonConstants.VIDEO_GRID_COLUMNS[0]; + if (windowWidthVp < 320) { + widthBp = 'xs'; + videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[0]; + } else if (windowWidthVp >= 320 && windowWidthVp < 600) { + widthBp = 'sm'; + videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[0]; + } else if (windowWidthVp >= 600 && windowWidthVp < 840) { + widthBp = 'md'; + videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[1]; + } else { + widthBp = 'lg'; + videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[2]; + } + AppStorage.setOrCreate('currentWidthBreakpoint', widthBp); + AppStorage.setOrCreate('videoGridColumn', videoGridColumn); + } + // [End update_width_bp] + updateHeightBp(): void { + let mainWindow: window.WindowProperties = this.mainWindowClass!.getWindowProperties(); + let windowHeight: number = mainWindow.windowRect.height; + let windowWidth: number = mainWindow.windowRect.width; + let windowWidthVp = windowWidth / (display.getDefaultDisplaySync().densityDPI / 160); + let windowHeightVp = windowHeight / (display.getDefaultDisplaySync().densityDPI / 160); + let heightBp: string = ''; + let aspectRatio: number = windowHeightVp / windowWidthVp; + if (aspectRatio < 0.8) { + heightBp = 'sm'; + } else if (aspectRatio >= 0.8 && aspectRatio < 1.2) { + heightBp = 'md'; + } else { + heightBp = 'lg'; + } + AppStorage.setOrCreate('currentHeightBreakpoint', heightBp); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/commons/base/src/main/module.json5 b/MultiVideoApplication/commons/base/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5b88767e30950571337935f398f2dcbf4d1b822d --- /dev/null +++ b/MultiVideoApplication/commons/base/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "base", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/Index.ets b/MultiVideoApplication/features/home/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7434a219ce671f411211ca842ebc7d866addfe88 --- /dev/null +++ b/MultiVideoApplication/features/home/Index.ets @@ -0,0 +1 @@ +export { Home } from './src/main/ets/view/Home'; \ No newline at end of file diff --git a/MultiVideoApplication/features/home/build-profile.json5 b/MultiVideoApplication/features/home/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3167e54d1ff3a0aaa0cdcf4319789de8e3f3c350 --- /dev/null +++ b/MultiVideoApplication/features/home/build-profile.json5 @@ -0,0 +1,10 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/hvigorfile.ts b/MultiVideoApplication/features/home/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiVideoApplication/features/home/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiVideoApplication/features/home/oh-package.json5 b/MultiVideoApplication/features/home/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d1e6d05327c28f34e9d1893bb722b83e88b20462 --- /dev/null +++ b/MultiVideoApplication/features/home/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "home", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/search": "file:../search", + "@ohos/commons": "file:../../commons/base" + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/constants/HomeConstants.ets b/MultiVideoApplication/features/home/src/main/ets/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..44ae6863fff64eb8a2e8686362f51d177773aba4 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/constants/HomeConstants.ets @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2023 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 class HomeConstants { + /** + * Top tab topics. + */ + static readonly TOP_TOPIC_LIST: ResourceStr[] = + [$r('app.string.sift'), $r('app.string.video'), $r('app.string.community'), $r('app.string.news'), + $r('app.string.shop'), $r('app.string.science'), $r('app.string.finance'), $r('app.string.history'), + $r('app.string.affairs')]; + /** + * Icon list. + */ + static readonly ICON_LIST: ResourceStr[] = + [$r('app.string.all'), $r('app.string.heat_list'), $r('app.string.free'), $r('app.string.sutra'), + $r('app.string.prefecture'), $r('app.string.kids_only'), $r('app.string.zone'), $r('app.string.Premium_products'), + $r('app.string.Fitness')]; + /** + * Banner text 1. + */ + static readonly BANNER_TEXT_1: ResourceStr[] = ['HUAWEI ', 'Mate Book ', $r('app.string.new')]; + /** + * Banner text 2. + */ + static readonly BANNER_TEXT_2: ResourceStr[] = ['HUAWEI ', '', $r('app.string.new')]; + /** + * Banner text 3. + */ + static readonly BANNER_TEXT_3: ResourceStr[] = ['HUAWEI P60 ', '', $r('app.string.new')]; + /** + * Banner text 4. + */ + static readonly BANNER_TEXT_4: ResourceStr[] = ['HUAWEI P50', '', $r('app.string.new')]; + /** + * Video grid rate list. + */ + static readonly VIDEO_GRID_RATES: string[] = ['7.8', '8.0', '7.9', '8.4', '7.8', '8.0', '7.9', '8.4', '7.6', '8.0']; + /** + * Video grid name list. + */ + static readonly VIDEO_GRID_NAMES: ResourceStr[] = + [$r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), + $r('app.string.cultural'), + $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), + $r('app.string.cultural')]; + /** + * Video grid content list. + */ + static readonly VIDEO_GRID_CONTENTS: ResourceStr[] = [$r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), $r('app.string.europe')]; + /** + * New video grid rate list. + */ + static readonly NEW_VIDEO_RATES: string[] = ['', '', '7.9', '7.9', '7.9', '7.9', '7.9']; + /** + * New video name list. + */ + static readonly NEW_VIDEO_NAMES: ResourceStr[] = + ['HUAWEI Mate30 ...', $r('app.string.life'), $r('app.string.life'), $r('app.string.life'), + $r('app.string.life'), $r('app.string.life'), $r('app.string.life')]; + /** + * New video content list. + */ + static readonly NEW_VIDEO_CONTENTS: ResourceStr[] = + [$r('app.string.landscape'), $r('app.string.landscape'), $r('app.string.landscape'), + $r('app.string.landscape'), $r('app.string.landscape'), $r('app.string.landscape'), $r('app.string.landscape')]; + /** + * Main daily video rate. + */ + static readonly MAIN_DAILY_VIDEO_RATE: string = '8.4'; + /** + * Main daily video name. + */ + static readonly MAIN_DAILY_VIDEO_NAME: ResourceStr = $r('app.string.explore'); + /** + * Main daily video content. + */ + static readonly MAIN_DAILY_VIDEO_CONTENT: ResourceStr = $r('app.string.source'); + /** + * Main daily video more info. + */ + static readonly MAIN_DAILY_VIDEO_MORE: ResourceStr = $r('app.string.source'); + /** + * Daily video rate list. + */ + static readonly DAILY_VIDEO_RATES: string[] = ['8.4', '8.4', '8.4', '8.4']; + /** + * Daily video name list. + */ + static readonly DAILY_VIDEO_NAMES: ResourceStr[] = + [$r('app.string.lonely'), $r('app.string.lonely'), $r('app.string.lonely'), $r('app.string.lonely')]; + /** + * Daily video name list. + */ + static readonly DAILY_VIDEO_CONTENTS: ResourceStr[] = [$r('app.string.source'), $r('app.string.source'), + $r('app.string.source'), $r('app.string.source')]; + /** + * Previous video name list one. + */ + static readonly PREVIOUS_VIDEO_NAMES_ONE: ResourceStr[] = [$r('app.string.life'), $r('app.string.life'), + $r('app.string.life')]; + /** + * Previous video content list one. + */ + static readonly PREVIOUS_VIDEO_CONTENTS_ONE: ResourceStr[] = [$r('app.string.film'), $r('app.string.film'), + $r('app.string.film')]; + /** + * Previous video more info list one. + */ + static readonly PREVIOUS_VIDEO_MORE_ONE: ResourceStr[] = + [$r('app.string.plays'), $r('app.string.plays'), $r('app.string.plays')]; + /** + * Previous video name list two. + */ + static readonly PREVIOUS_VIDEO_NAMES_TWO: ResourceStr[] = + [$r('app.string.life'), $r('app.string.life'), $r('app.string.life'), + $r('app.string.life'), $r('app.string.life'), $r('app.string.life')]; + /** + * Previous video content list two. + */ + static readonly PREVIOUS_VIDEO_CONTENTS_TWO: ResourceStr[] = [$r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), $r('app.string.europe'), $r('app.string.europe')]; + /** + * Banner text letter space list. + */ + static readonly BANNER_TEXT_LETTER_SPACES: string[] = ['2vp', '3vp', '1vp']; + /** + * Swiper item space. + */ + static readonly SWIPER_ITEM_SPACE: string = '12vp'; + /** + * Banner row space. + */ + static readonly BANNER_ROW_SPACE: string = '12vp'; + /** + * Home sub title list. + */ + static readonly HOME_SUB_TITLES: ResourceStr[] = + [$r('app.string.release'), $r('app.string.tablet'), $r('app.string.back')]; + /** + * New video rows template. + */ + static readonly NEW_VIDEO_ROWS_TEMPLATE: string = '1fr'; + /** + * Main daily video button text. + */ + static readonly HOME_BUTTON_TEXT: ResourceStr[] = + [$r('app.string.follow'), $r('app.string.play_on'), $r('app.string.player'), $r('app.string.cache')]; + /** + * Previous two list translate position. + */ + static readonly PREVIOUS_TWO_TRANSLATE_MD: string = '-42vp'; + /** + * Search placeholder. + */ + static readonly SEARCH_PLACEHOLDER: ResourceStr = $r('app.string.search'); + /** + * Video dialog option list. + */ + static readonly VIDEO_DIALOG_OPTIONS: ResourceStr[] = [$r('app.string.binge_watch'), $r('app.string.Collect'), $r('app.string.like')]; + /** + * Side bar icon list height. + */ + static readonly SIDE_ICON_LIST_HEIGHT: string = '25%'; + /** + * Square brackets. + */ + static readonly SQUARE_BRACKETS: string[] = ['[', ']']; + /** + * Height unit. + */ + static readonly HEIGHT_UNIT: string = 'vp'; + /** + * Two. + */ + static readonly TWO: number = 2; + /** + * Five. + */ + static readonly FIVE: number = 5; + /** + * Six. + */ + static readonly SIX: number = 6; + /** + * Seven. + */ + static readonly SEVEN: number = 7; + /** + * Eight. + */ + static readonly EIGHT: number = 8; + /** + * Video dialog height list. + */ + static readonly VIDEO_DIALOG_HEIGHTS: number[] = [161, 268, 347]; + /** + * Video dialog aspect ratio. + */ + static readonly VIDEO_DIALOG_ASPECT_RATIO: number = 1.74; + /** + * New banner aspect ratio. + */ + static readonly NEW_BANNER_ASPECT_RATIO: number = 1.5; + /** + * Home header background change height. + */ + static readonly BACKGROUND_CHANGE_HEIGHT: number[] = [27, 34, 56]; + /** + * Video grid item space. + */ + static readonly VIDEO_GRID_ITEM_SPACE: number = 12; + /** + * Video grid margin. + */ + static readonly VIDEO_GRID_MARGIN: number[] = [32, 48, 64]; + /** + * Number of displayed icons. + */ + static readonly DISPLAYED_ICON_NUMBER: number[] = [9, 13, 17]; + /** + * Lg sidebar width. + */ + static readonly LG_SIDEBAR_WIDTH: number = 96; + /** + * Video grid description height. + */ + static readonly VIDEO_GRID_DESCRIPTION_HEIGHT: number = 120; + /** + * New video aspect ratio. + */ + static readonly NEW_VIDEO_ASPECT_RATIO: number = 0.72; + /** + * New video description height. + */ + static readonly NEW_VIDEO_DESCRIPTION_HEIGHT: number = 71; + /** + * Daily video description height. + */ + static readonly DAILY_VIDEO_DESCRIPTION_HEIGHT: number[] = [103, 88, 115, 62]; + /** + * Previous two ratio list. + */ + static readonly PREVIOUS_TWO_RATIOS: number[] = [0.76, 0.89, 0.86, 0.74, 0.8, 0.9, 0.83]; + /** + * Banner aspect ratio list. + */ + static readonly BANNER_RATIOS: number[] = [1.49, 1.6, 2.1]; + /** + * Home header height for sm. + */ + static readonly HOME_HEADER_HEIGHT_SM: number = 112; + /** + * Window undefined top. + */ + static readonly WINDOW_UNDEFINED_TOP: number = 39; + /** + * Window undefined left. + */ + static readonly WINDOW_UNDEFINED_LEFT: number = 5; + /** + * Eleven. + */ + static readonly ELEVEN: number = 11; + /** + * Banner text 1 left position for md. + */ + static readonly BANNER_TEXT_1_LEFT_MD: string = '8%'; + /** + * Banner text 2 left position for md. + */ + static readonly BANNER_TEXT_2_LEFT_MD: string = '8%'; + /** + * Banner text 2 left position for lg. + */ + static readonly BANNER_TEXT_2_LEFT_LG: string = '5%'; + /** + * Banner text 1 top position for sm. + */ + static readonly BANNER_TEXT_1_TOP_SM: string[] = ['15%', '2vp']; + /** + * Banner text 1 top position for md. + */ + static readonly BANNER_TEXT_1_TOP_MD: string[] = ['8%', '4vp']; + /** + * Banner text 1 top position for lg. + */ + static readonly BANNER_TEXT_1_TOP_LG: string[] = ['5%', '2vp']; + /** + * Banner text 2 top position for sm. + */ + static readonly BANNER_TEXT_2_TOP_SM: string[] = ['15%', '2vp']; + /** + * Banner text 2 top position for md. + */ + static readonly BANNER_TEXT_2_TOP_MD: string[] = ['10%', '4vp']; + /** + * Banner text 2 top position for lg. + */ + static readonly BANNER_TEXT_2_TOP_LG: string[] = ['10%', '8vp']; + /** + * Video detail url. + */ + static readonly VIDEO_DETAIL_URL: string = '@bundle:com.huawei.videoapplication/videoDetail/ets/pages/Index'; + /** + * Direction list. + */ + static readonly DIRECTION_LIST: string[] = ['BottomTabs', 'TopTabs', 'Banner', 'IconList', 'RecommendedVideo', + 'NewRelease', 'DailyVideoOne', 'DailyVideoTwo', 'PreviousVideo']; + /** + * Percent 105. + */ + static readonly PERCENT_HUNDRED_AND_FIVE: string = '105%'; + /** + * Animation duration. + */ + static readonly ANIMATION_DURATION: number = 500; + /** + * Item width of IconView. + */ + static readonly ICONVIEW_ITEM_WIDTH: number[] = [40, 43, 45]; +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/utils/PreviousVideoUtil.ets b/MultiVideoApplication/features/home/src/main/ets/utils/PreviousVideoUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c82b70e97134f1d64c13c838edb1b95537c62e6 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/utils/PreviousVideoUtil.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +export class PreviousVideoUtil { + static getImgAspectRatio(currentWidthBreakpoint: string, index: number): number { + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + switch (index) { + case 2: + return HomeConstants.PREVIOUS_TWO_RATIOS[0]; + case 3: + return HomeConstants.PREVIOUS_TWO_RATIOS[1]; + default: + return HomeConstants.PREVIOUS_TWO_RATIOS[2]; + } + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + switch (index) { + case 2: + return HomeConstants.PREVIOUS_TWO_RATIOS[3]; + case 3: + return HomeConstants.PREVIOUS_TWO_RATIOS[2]; + case 4: + return HomeConstants.PREVIOUS_TWO_RATIOS[4]; + case 5: + return HomeConstants.PREVIOUS_TWO_RATIOS[5]; + default: + return HomeConstants.PREVIOUS_TWO_RATIOS[6]; + } + } else { + switch (index) { + case 2: + return HomeConstants.PREVIOUS_TWO_RATIOS[3]; + case 3: + return HomeConstants.PREVIOUS_TWO_RATIOS[2]; + case 4: + return HomeConstants.PREVIOUS_TWO_RATIOS[4]; + default: + return HomeConstants.PREVIOUS_TWO_RATIOS[6]; + } + } + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/BannerView.ets b/MultiVideoApplication/features/home/src/main/ets/view/BannerView.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa54e3f3b9befb1de13c6592d84c184338bd1bf --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/BannerView.ets @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { Banner, BannerViewModel } from '../viewmodel/BannerViewModel'; +import { getTabIndex } from './CommonView'; + +class BannerDataSource implements IDataSource { + private bannerImgList: Banner[] = []; + + constructor(bannerImgList: Banner[]) { + this.bannerImgList = bannerImgList; + } + + totalCount(): number { + return this.bannerImgList.length; + } + + getData(index: number): Banner { + return this.bannerImgList[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + } + + unregisterDataChangeListener() { + } +} + +@Component +export struct BannerView { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + private bannerImgList: Banner[] = new BannerViewModel().getBannerList(); + private bannerDataSource: BannerDataSource = new BannerDataSource([]); + + aboutToAppear(): void { + this.bannerDataSource = new BannerDataSource(this.bannerImgList); + } + + build() { + Column() { + // Banner layout. + Row() { + // [Start banner_iew] + Swiper() { + LazyForEach(this.bannerDataSource, (item: Banner, index: number) => { + // [StartExclude banner_view] + Stack() { + Image(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? item.getBannerImg().getImgSrcSm() : + item.getBannerImg().getImgSrc()) + .objectFit(ImageFit.Fill) + .borderRadius($r('app.float.banner_img_border_radius')) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .focusable(true) + .zIndex(1) + + Column() { + Text(item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + `${item.getDescription().getDescription()[0]}${item.getDescription().getDescription()[1]}` : + item.getDescription().getDescription()[0]) + .fontSize(item.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) + .fontWeight(item.getDescription().getFontWeight()[0]) + .lineHeight(item.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + + Text(item.getDescription().getDescription()[1]) + .fontSize(item.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) + .fontWeight(item.getDescription().getFontWeight()[0]) + .lineHeight(item.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + .visibility(item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + Visibility.None : Visibility.Visible) + + Text(item.getDescription().getDescription()[2]) + .fontSize(item.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[1]) + .fontWeight(item.getDescription().getFontWeight()[1]) + .lineHeight(item.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[1]) + .fontColor(Color.White) + .margin({ + top: item.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[1] + }) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[1]) + .maxLines(1) + } + .padding({ + left: !item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + item.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', + top: !item.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? + item.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' + }) + .alignItems(item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + HorizontalAlign.Center : HorizontalAlign.Start) + .justifyContent(!item.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? + FlexAlign.Start : FlexAlign.Center) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .zIndex(2) + } + // [EndExclude banner_view] + .height(item.getBannerImg().getHeight().getValue(this.currentWidthBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + // The width and height vary with the container assembly and the aspect ratio remains unchanged. + .aspectRatio(new BreakpointType(HomeConstants.BANNER_RATIOS[0], HomeConstants.BANNER_RATIOS[1], + HomeConstants.BANNER_RATIOS[2]).getValue(this.currentWidthBreakpoint)) + .groupDefaultFocus(index === 0 ? true : false) + .focusable(true) + .padding({ + top: $r('app.float.banner_margin'), + bottom: $r('app.float.banner_margin'), + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.banner_padding_sm') : 0, + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.banner_padding_sm') : 0 + }) + }, (item: Banner, index: number) => index + JSON.stringify(item)) + } + .displayCount(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? 1 : HomeConstants.TWO) + // Interval between banner images + .itemSpace(HomeConstants.SWIPER_ITEM_SPACE) + .prevMargin(new BreakpointType($r('app.float.swiper_prev_next_margin_sm'), + $r('app.float.swiper_prev_next_margin_md'), $r('app.float.swiper_prev_next_margin_lg')) + .getValue(this.currentWidthBreakpoint)) + .nextMargin(new BreakpointType($r('app.float.swiper_prev_next_margin_sm'), + $r('app.float.swiper_prev_next_margin_md'), $r('app.float.swiper_prev_next_margin_lg')) + .getValue(this.currentWidthBreakpoint)) + // [End banner_view] + // Setting the navigation point Style of the swiper. + .indicator(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Indicator.dot() + .itemWidth($r('app.float.swiper_item_size')) + .itemHeight($r('app.float.swiper_item_size')) + .selectedItemWidth($r('app.float.swiper_selected_item_width')) + .selectedItemHeight($r('app.float.swiper_item_size')) + .color($r('app.color.swiper_indicator')) + .bottom($r('app.float.indicator_bottom')) + .selectedColor(Color.White) : false + ) + .loop(true) + .width(CommonConstants.FULL_PERCENT) + .visibility((this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && + (this.currentTopIndex === 1) ? Visibility.None : Visibility.Visible) + .effectMode(EdgeEffect.None) + // The sizes of the front and rear banners on the MD and LG devices are different. + .index(2) + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[2])) + + // Switch the tab to switch the banner display effect. + // [Start banner_view_row] + Row({ space: HomeConstants.BANNER_ROW_SPACE }) { + BannerText({ + banner: this.bannerImgList[2], + index: 0 + }) + .layoutWeight(CommonConstants.FOUR) + .height(CommonConstants.FULL_PERCENT) + + BannerText({ + banner: this.bannerImgList[1], + index: 1 + }) + .layoutWeight(CommonConstants.FOUR) + .height(CommonConstants.FULL_PERCENT) + + Column() { + BannerText({ + banner: this.bannerImgList[0], + index: 2 + }) + .margin({ bottom: $r('app.float.new_banner_3_margin') }) + .layoutWeight(1) + + BannerText({ + banner: this.bannerImgList[4], + index: 3 + }) + .margin({ top: $r('app.float.new_banner_3_margin') }) + .layoutWeight(1) + } + .layoutWeight(CommonConstants.THREE) + } + .height(this.getBannerNewHeight(this.windowWidth)) + .width(CommonConstants.FULL_PERCENT) + .visibility((this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && + (this.currentTopIndex === 1) ? Visibility.Visible : Visibility.None) + .padding({ + left: $r('app.float.banner_padding_sm'), + right: $r('app.float.banner_padding_sm') + }) + // [End banner_view_row] + } + .width(CommonConstants.FULL_PERCENT) + .visibility(this.currentTopIndex === 2 ? Visibility.None : Visibility.Visible) + + Row() { + // Immersive layout. + Column() { + Text(this.bannerImgList[2].getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + `${this.bannerImgList[2].getDescription().getDescription()[0]}${this.bannerImgList[2].getDescription() + .getDescription()[1]}` : this.bannerImgList[2].getDescription().getDescription()[0]) + .fontSize(new BreakpointType($r('app.float.immersive_text_1_font_sm'), + $r('app.float.immersive_text_1_font_md'), $r('app.float.immersive_text_1_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontWeight(this.bannerImgList[2].getDescription().getFontWeight()[0]) + .lineHeight(new BreakpointType($r('app.float.immersive_text_1_line_sm'), + $r('app.float.immersive_text_1_line_md'), $r('app.float.immersive_text_1_line_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + + Text(this.bannerImgList[2].getDescription().getDescription()[1]) + .fontSize(new BreakpointType($r('app.float.immersive_text_1_font_sm'), + $r('app.float.immersive_text_1_font_md'), $r('app.float.immersive_text_1_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontWeight(this.bannerImgList[2].getDescription().getFontWeight()[0]) + .lineHeight(new BreakpointType($r('app.float.immersive_text_1_line_sm'), + $r('app.float.immersive_text_1_line_md'), $r('app.float.immersive_text_1_line_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + .visibility(this.bannerImgList[2].getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + Visibility.None : Visibility.Visible) + + Text(this.bannerImgList[2].getDescription().getDescription()[2]) + .fontSize(new BreakpointType($r('app.float.immersive_text_2_font_sm'), + $r('app.float.immersive_text_2_font_md'), $r('app.float.immersive_text_2_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontWeight(this.bannerImgList[2].getDescription().getFontWeight()[1]) + .lineHeight(new BreakpointType($r('app.float.immersive_text_2_line_sm'), + $r('app.float.immersive_text_2_line_md'), $r('app.float.immersive_text_2_line_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontColor(Color.White) + .margin({ + top: this.bannerImgList[2].getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[1] + }) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[1]) + .maxLines(1) + } + .padding({ + left: new BreakpointType($r('app.float.immersive_col_padding_left_sm'), + $r('app.float.immersive_col_padding_left_md'), $r('app.float.immersive_col_padding_left_lg')) + .getValue(this.currentWidthBreakpoint), + top: new BreakpointType($r('app.float.immersive_col_padding_top_sm'), + $r('app.float.immersive_col_padding_top_md'), $r('app.float.immersive_col_padding_top_lg')) + .getValue(this.currentWidthBreakpoint) + }) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .alignItems(new BreakpointType(true, false, false).getValue(this.currentWidthBreakpoint) ? + HorizontalAlign.Center : HorizontalAlign.Start) + .justifyContent(!this.bannerImgList[2].getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? + FlexAlign.Start : FlexAlign.Center) + } + .margin({ + top: $r('app.float.immersive_col_margin') + }) + .padding({ + left: $r('app.float.home_content_padding'), + right: $r('app.float.home_content_padding') + }) + .height(new BreakpointType($r('app.float.immersive_banner_height_sm'), $r('app.float.immersive_banner_height_md'), + $r('app.float.immersive_banner_height_lg')).getValue(this.currentWidthBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.currentTopIndex === 2 ? Visibility.Visible : Visibility.None) + } + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 + }) + } + + getBannerNewHeight(windowWidth: number): string { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) - + HomeConstants.LG_SIDEBAR_WIDTH; + // Calculate the width of a single image based on the percent. + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * HomeConstants.TWO) * CommonConstants.FOUR / + HomeConstants.ELEVEN; + // Calculate the total height of the grid layout. + return result / HomeConstants.NEW_BANNER_ASPECT_RATIO + HomeConstants.HEIGHT_UNIT; + } +} + +@Component +struct BannerText { + public banner: Banner = new BannerViewModel().getBannerList()[0]; + public currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + public index: number = 0; + + build() { + Stack() { + Image(((this.index === 0) || (this.index === 1)) ? this.banner.getBannerImg().getImgSrcSm() : + this.banner.getBannerImg().getImgSrc()) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .objectFit(ImageFit.Fill) + .borderRadius($r('app.float.banner_img_border_radius')) + + Column() { + Text(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + `${this.banner.getDescription().getDescription()[0]}${this.banner.getDescription().getDescription()[1]}` : + this.banner.getDescription().getDescription()[0]) + .fontSize(this.banner.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) + .fontWeight(this.banner.getDescription().getFontWeight()[0]) + .lineHeight(this.banner.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + Text(this.banner.getDescription().getDescription()[1]) + .fontSize(this.banner.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) + .fontWeight(this.banner.getDescription().getFontWeight()[0]) + .lineHeight(this.banner.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) + .fontColor(Color.White) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[2]) + .maxLines(1) + .visibility(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + Visibility.None : Visibility.Visible) + + Text(this.banner.getDescription().getDescription()[2]) + .fontSize(this.banner.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[1]) + .fontWeight(this.banner.getDescription().getFontWeight()[1]) + .lineHeight(this.banner.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[1]) + .fontColor(Color.White) + .margin({ top: this.banner.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[1] }) + .letterSpacing(HomeConstants.BANNER_TEXT_LETTER_SPACES[1]) + .maxLines(1) + } + .padding({ + left: !this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + this.banner.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', + top: !this.banner.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? + this.banner.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' + }) + .alignItems(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? + HorizontalAlign.Center : HorizontalAlign.Start) + .justifyContent(!this.banner.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? + FlexAlign.Start : FlexAlign.Center) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/CommonView.ets b/MultiVideoApplication/features/home/src/main/ets/view/CommonView.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e490b6a9addd04505b8a47aa48ce99c9d83e945 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/CommonView.ets @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct VideoImgRating { + public rating: string = ''; + + build() { + Row() { + Text(this.rating) + .fontSize($r('app.float.video_img_rating_font')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .height($r('app.float.video_img_rating_height')) + .width($r('app.float.video_img_rating_width')) + .margin({ + right: $r('app.float.video_img_rating_margin'), + bottom: $r('app.float.video_img_rating_margin') + }) + .backgroundColor($r('app.color.main_daily_rating_background')) + .borderRadius($r('app.float.video_img_rating_radius')) + .textAlign(TextAlign.Center) + } + .justifyContent(FlexAlign.End) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.rating === '' ? Visibility.None : Visibility.Visible) + } +} + +@Component +export struct VideoTitle { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + public title: ResourceStr = ''; + + build() { + Text(this.title) + .fontWeight(FontWeight.Normal) + .fontSize($r('app.float.video_title_font')) + .lineHeight($r('app.float.video_title_line')) + .margin({ top: $r('app.float.video_title_margin') }) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .maxLines(1) + } +} + +@Component +export struct VideoContent { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + public content: ResourceStr = ''; + + build() { + Text(this.content) + .fontSize($r('app.float.video_content_font')) + .lineHeight($r('app.float.video_content_line')) + .opacity(CommonConstants.TEXT_OPACITY[0]) + .fontWeight(FontWeight.Normal) + .maxLines(1) + .margin({ top: $r('app.float.video_content_margin') }) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + } +} + +@Component +export struct SubtitleComponent { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + public title: ResourceStr = ''; + + build() { + Text(this.title) + .fontSize($r('app.float.sub_title_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .lineHeight($r('app.float.sub_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint)}) + } +} + +@Component +export struct VideoImgComponent { + public imgSrc?: Resource; + public index: number = 0; + + build() { + Image(this.imgSrc ? this.imgSrc : '') + .focusable(true) + .groupDefaultFocus(this.index === 0 ? true : false) + .objectFit(ImageFit.Fill) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .draggable(false) + .borderRadius($r('app.float.banner_focus_radius')) + } +} + +@Component +export struct VideoImgPlay { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + + build() { + Column() { + Image($r('app.media.new_video_play')) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.video_img_size_lg') : + $r('app.float.video_img_size')) + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.video_img_size_lg') : + $r('app.float.video_img_size')) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + } +} + +export function getTabIndex(direction: string): number { + let tabIndex: number = 0; + switch (direction) { + case HomeConstants.DIRECTION_LIST[0]: + tabIndex = 1; + break; + case HomeConstants.DIRECTION_LIST[1]: + tabIndex = 2; + break; + case HomeConstants.DIRECTION_LIST[2]: + tabIndex = 3; + break; + case HomeConstants.DIRECTION_LIST[3]: + tabIndex = 4; + break; + case HomeConstants.DIRECTION_LIST[4]: + tabIndex = 5; + break; + case HomeConstants.DIRECTION_LIST[5]: + tabIndex = 6; + break; + case HomeConstants.DIRECTION_LIST[6]: + tabIndex = 7; + break; + case HomeConstants.DIRECTION_LIST[7]: + tabIndex = 8; + break; + case HomeConstants.DIRECTION_LIST[8]: + tabIndex = 9; + break; + default: + break; + } + return tabIndex; +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/DailyVideo.ets b/MultiVideoApplication/features/home/src/main/ets/view/DailyVideo.ets new file mode 100644 index 0000000000000000000000000000000000000000..89d5d2091d5f226e365e7c87233c4fc1ebacb1f0 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/DailyVideo.ets @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { VideoImage, VideoImgViewModel } from '../viewmodel/VideoImgViewModel'; +import { getTabIndex, SubtitleComponent, VideoImgComponent, VideoImgPlay, VideoImgRating } from './CommonView'; + +@Component +export struct DailyVideo { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + @State isShowingMainBorder: boolean = false; + private dailyVideoImgList: VideoImage[] = new VideoImgViewModel().getDailyVideoImgList(); + private mainDailyVideoImg: VideoImage = new VideoImgViewModel().getMainDailyVideoImg(); + + build() { + // [Start daily_video_column] + Column() { + SubtitleComponent({ title: HomeConstants.HOME_SUB_TITLES[1] }) + + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + }, + gutter: $r('app.float.grid_row_gutter') + }) { + // Main video section. + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[1], + lg: BreakpointConstants.GRID_COLUMN_SPANS[1] + } + }) { + Column() { + // [StartExclude daily_video_column] + Stack({ alignContent: Alignment.Bottom }) { + Image(this.mainDailyVideoImg.getImgSrc() ? this.mainDailyVideoImg.getImgSrc() : '') + .focusable(true) + .objectFit(ImageFit.Fill) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .draggable(false) + .borderRadius({ + topLeft: $r('app.float.daily_main_focus_radius'), + topRight: $r('app.float.daily_main_focus_radius') + }) + VideoImgPlay() + + Row() { + Text(this.mainDailyVideoImg.getTitle()) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_title_font_lg') : $r('app.float.main_daily_title_font')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + .margin({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_margin_lg') : $r('app.float.main_daily_margin') }) + .layoutWeight(1) + .maxLines(1) + + Text(this.mainDailyVideoImg.getRating()) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_font_lg') : $r('app.float.main_daily_rating_font')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_height_lg') : $r('app.float.main_daily_rating_height')) + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_width_lg') : $r('app.float.main_daily_rating_width')) + .margin({ + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG? + $r('app.float.main_daily_rating_right_lg') : $r('app.float.main_daily_rating_right'), + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_top_lg') : $r('app.float.main_daily_rating_top') + }) + .backgroundColor($r('app.color.main_daily_rating_background')) + .borderRadius(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_radius_lg') : $r('app.float.main_daily_rating_radius')) + .textAlign(TextAlign.Center) + } + .alignItems(VerticalAlign.Top) + .justifyContent(FlexAlign.Start) + .width(CommonConstants.FULL_PERCENT) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_row_height_lg') : $r('app.float.main_daily_row_height')) + } + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(5) + + Row() { + // [Start daily_video_row] + Image($r('app.media.daily_small_video')) + .height(new BreakpointType($r('app.float.small_daily_image_height_sm'), + $r('app.float.small_daily_image_height_md'), $r('app.float.small_daily_image_height_lg')) + .getValue(this.currentWidthBreakpoint)) + .width(new BreakpointType($r('app.float.small_daily_image_width_sm'), + $r('app.float.small_daily_image_width_md'), $r('app.float.small_daily_image_width_lg')) + .getValue(this.currentWidthBreakpoint)) + .borderRadius($r('app.float.daily_small_img_radius')) + // [End daily_video_row] + Column() { + Text(this.mainDailyVideoImg.getOtherInfo()) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_other_font_lg') : $r('app.float.main_daily_other_font')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + Text(this.mainDailyVideoImg.getContent()) + .opacity(CommonConstants.TEXT_OPACITY[0]) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_content_font_lg') : $r('app.float.main_daily_content_font')) + .fontWeight(FontWeight.Normal) + .maxLines(1) + } + .margin({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.small_daily_column_margin_lg'): $r('app.float.small_daily_column_margin'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.small_daily_column_margin_lg'): $r('app.float.small_daily_column_margin') + }) + .alignItems(HorizontalAlign.Start) + .layoutWeight(1) + + Button(HomeConstants.HOME_BUTTON_TEXT[0]) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_button_font_lg'): $r('app.float.main_daily_button_font')) + .fontColor($r('app.color.tab_sel_color')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_button_height_lg') : $r('app.float.main_daily_button_height_lg')) + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_button_width_lg') : $r('app.float.main_daily_button_width_lg')) + .borderRadius($r('app.float.main_daily_button_radius')) + .backgroundColor($r('app.color.button_background')) + } + .alignItems(VerticalAlign.Center) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding') + }) + .layoutWeight(2) + // [EndExclude daily_video_column] + } + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[6])) + .width(CommonConstants.FULL_PERCENT) + // Dynamically setting the height at different breakpoints. + .height(this.getDailyVideoHeight(this.currentWidthBreakpoint, this.windowWidth, true)) + .borderRadius($r('app.float.card_radius')) + .backgroundColor($r('app.color.home_component_background')) + } + // [StartExclude daily_video_column] + .padding({ + top: $r('app.float.sub_title_row_margin'), + bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.sub_title_row_margin') : 0, + left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.home_content_padding_sm') : 0 + }) + // [EndExclude daily_video_column] + // Sub video section. + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[1], + lg: BreakpointConstants.GRID_COLUMN_SPANS[1] + } + }) { + Grid() { + ForEach(this.dailyVideoImgList, (item: VideoImage) => { + GridItem() { + Column() { + Stack({ alignContent: Alignment.Bottom }) { + VideoImgComponent({ imgSrc: item.getImgSrc() }) + VideoImgPlay() + VideoImgRating({ rating: item.getRating() }) + } + .width(CommonConstants.FULL_PERCENT) + // The width and height vary with the container assembly and the aspect ratio remains unchanged. + .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) + // [StartExclude daily_video_column] + Text(item.getTitle()) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.daily_title_font_lg') : $r('app.float.daily_title_font')) + .fontWeight(FontWeight.Normal) + .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.video_title_line_lg') : $r('app.float.video_title_line')) + .margin({ top: $r('app.float.daily_title_margin') }) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + + Text(item.getContent()) + .fontSize($r('app.float.daily_content_font')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.video_content_line')) + .margin({ top: $r('app.float.daily_content_margin') }) + .opacity(CommonConstants.TEXT_OPACITY[0]) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.Visible : + Visibility.None) + // [EndExclude daily_video_column] + } + .alignItems(HorizontalAlign.Start) + } + }, (item: VideoImage, index: number) => index + JSON.stringify(item)) + } + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[7])) + // Dynamically setting the height at different breakpoints. + .height(this.getDailyVideoHeight(this.currentWidthBreakpoint, this.windowWidth, false)) + .width(CommonConstants.FULL_PERCENT) + // Sets the number of grid layout columns and evenly divides the height. + .columnsTemplate(CommonConstants.VIDEO_GRID_COLUMNS[0]) + .rowsTemplate(CommonConstants.VIDEO_GRID_COLUMNS[0]) + .rowsGap($r('app.float.daily_grid_gap')) + .columnsGap($r('app.float.daily_grid_gap')) + // [StartExclude daily_video_column] + .padding({ + top: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), + bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.home_content_padding_sm') : $r('app.float.focus_more_size'), + right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint) + }) + // [EndExclude daily_video_column] + } + } + } + .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 }) + .margin({ top: $r('app.float.main_daily_margin') }) + // [End daily_video_column] + } + + getDailyVideoHeight(currentWidthBreakpoint: string, windowWidth: number, isMain: boolean): string { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) - + HomeConstants.VIDEO_GRID_ITEM_SPACE; + // Calculate the width of a single image based on the number of grid columns. + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = (result - HomeConstants.LG_SIDEBAR_WIDTH) / HomeConstants.TWO; + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result /= HomeConstants.TWO; + } else { + result /= 1; + } + // Calculate the height of a single image and title, and calculate the total height of the grid layout. + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE) / HomeConstants.VIDEO_DIALOG_ASPECT_RATIO; + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + if (isMain) { + return (result + HomeConstants.DAILY_VIDEO_DESCRIPTION_HEIGHT[0] + HomeConstants.HEIGHT_UNIT); + } else { + return (result + HomeConstants.DAILY_VIDEO_DESCRIPTION_HEIGHT[2] + HomeConstants.HEIGHT_UNIT); + } + } else { + if (!isMain) { + return (result + HomeConstants.DAILY_VIDEO_DESCRIPTION_HEIGHT[1] + HomeConstants.HEIGHT_UNIT); + } else { + return (result + HomeConstants.DAILY_VIDEO_DESCRIPTION_HEIGHT[3] + HomeConstants.HEIGHT_UNIT); + } + } + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/Home.ets b/MultiVideoApplication/features/home/src/main/ets/view/Home.ets new file mode 100644 index 0000000000000000000000000000000000000000..06c94c6317c66b2492dd3847dc5b0c4e0817b2f5 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/Home.ets @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { SearchView } from '@ohos/search'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { FooterTab, FooterTabViewModel } from '../viewmodel/FooterTabViewModel'; +import { HomeHeader } from './HomeHeader'; +import { HomeContent } from './HomeContent'; + +@Component +export struct Home { + @State currentBottomIndex: number = 0; + @State isSearching: boolean = false; + @StorageLink('scrollHeight') scrollHeight: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + // [Start Home] + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + // [StartExclude Home] + private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); + private scroller: Scroller = new Scroller(); + private sideScroller: Scroller = new Scroller(); + + @Builder + BottomTabBuilder(item: FooterTab, index: number) { + Column() { + Image(index !== this.currentBottomIndex ? (this.currentTopIndex === 2 && this.currentBottomIndex === 0 && + !this.isSearching ? item.getIconWhite() : item.getIcon()) : item.getIconSelected()) + .width($r('app.float.icon_tab_width')) + .height($r('app.float.icon_tab_height')) + Text(item.getName()) + .fontSize($r('app.float.tab_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(index === this.currentBottomIndex ? $r('app.color.tab_sel_color') : (this.currentTopIndex === 2 && + this.currentBottomIndex === 0 && !this.isSearching ? Color.White : Color.Black)) + .margin({ top: $r('app.float.tab_top_margin') }) + .opacity(index === this.currentBottomIndex ? CommonConstants.TEXT_OPACITY[3] : CommonConstants.TEXT_OPACITY[0]) + } + .padding({ bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG && deviceInfo.deviceType !== + CommonConstants.DEVICE_TYPE ? $r('app.float.bottom_navigation') : 0 }) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.tab_height_lg') : + CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Center) + } + // [EndExclude Home] + build() { + // [Start home_tabs] + Tabs({ + barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End + }) { + // [StartExclude home_tabs] + // [Start home_tab_content] + TabContent() { + if (this.currentTopIndex === 2) { + // The immersive design of the home page is displayed when the top tab is switched to 2. + Stack() { + Scroll(this.sideScroller) { + Column() { + HomeContent() + .visibility(!this.isSearching ? Visibility.Visible : Visibility.None) + + SearchView({ isSearching: $isSearching }) + .visibility(!this.isSearching ? Visibility.None : Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + } + .scrollBar(BarState.Off) + .height(CommonConstants.FULL_PERCENT) + // Obtains the sliding offset on the y axis during sliding. + .onScrollFrameBegin((offset: number) => { + this.scrollHeight = this.sideScroller.currentOffset().yOffset; + return { offsetRemain: offset } + }) + + HomeHeader({ isSearching: $isSearching }) + .visibility(!this.isSearching ? Visibility.Visible : Visibility.None) + .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.side_bar_width') : 0 }) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .alignContent(Alignment.Top) + } else { + // Non-immersive design for the home page. + Column() { + HomeHeader({ isSearching: $isSearching }) + .visibility(!this.isSearching ? Visibility.Visible : Visibility.None) + + Scroll(this.scroller) { + Column() { + HomeContent() + .visibility(!this.isSearching ? Visibility.Visible : Visibility.None) + + SearchView({ isSearching: $isSearching }) + .visibility(!this.isSearching ? Visibility.None : Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + } + .layoutWeight(1) + .scrollBar(BarState.Off) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } + } + .tabBar(this.BottomTabBuilder(this.tabList[0], 0)) + // [End home_tab_content] + TabContent() { + Column() + } + .tabBar(this.BottomTabBuilder(this.tabList[1], 1)) + + TabContent() { + Column() + } + .tabBar(this.BottomTabBuilder(this.tabList[2], 2)) + + TabContent() { + Column() + } + .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) + // [EndExclude home_tabs] + } + // Change the position and size of the tab at the bottom. + .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : + CommonConstants.FULL_PERCENT) + .barHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : + (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.tab_size_lg') : + $r('app.float.tab_size'))) + .barMode(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, + { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) + .vertical(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) + // [End home_tabs] + .barOverlap(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? true : + false) + .barBackgroundBlurStyle(BlurStyle.NONE) + .barBackgroundColor(this.currentTopIndex === 2 && this.currentBottomIndex === 0 ? + (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.color.side_bar_background') : + $r('app.color.home_content_background')) : $r('app.color.tab_background_color')) + .onChange((index: number) => { + this.currentBottomIndex = index; + }) + .scrollable(false) + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/HomeContent.ets b/MultiVideoApplication/features/home/src/main/ets/view/HomeContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..10dd055e0266ee727ab2902cb855552b18f18280 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/HomeContent.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, BreakpointType, CommonConstants } from '@ohos/commons'; +import { WindowUtil } from '@ohos/commons'; +import { BannerView } from './BannerView'; +import { IconView } from './IconView'; +import { RecommendedVideo} from './RecommendedVideo'; +import { NewVideoRelease } from './NewVideoRelease'; +import { DailyVideo } from './DailyVideo'; +import { PreviousVideo } from './PreviousVideo'; + +@Component +export struct HomeContent { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + @State gridStatus: number = 1; + private windowUtil?: WindowUtil; + private isSearching: boolean = false; + + aboutToAppear(): void { + this.windowUtil = WindowUtil.getInstance(); + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPE) { + this.windowUtil!.setFullScreen(); + } + } + + build() { + // [Start home_content_build] + Column() { + // [StartExclude home_content_build] + BannerView() + IconView() + RecommendedVideo() + NewVideoRelease() + DailyVideo() + PreviousVideo() + // [EndExclude home_content_build] + } + // Set the background image to cover the side and top tabs. + .backgroundImage(this.currentTopIndex === 2 && !this.isSearching ? new BreakpointType( + $r('app.media.immersive_background_sm'), $r('app.media.immersive_background_md'), + $r('app.media.immersive_background_lg')).getValue(this.currentWidthBreakpoint) : $r('app.media.white_background')) + // Set the size of the background image. + .backgroundImageSize({ width: CommonConstants.FULL_PERCENT, height: new BreakpointType( + $r('app.float.immersive_background_height_sm'), $r('app.float.immersive_background_height_md'), + $r('app.float.immersive_background_height_lg')).getValue(this.currentWidthBreakpoint) }) + // Set the uniform background color. + .backgroundColor(this.currentTopIndex === 2 && !this.isSearching ? (this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_MD ? + $r('app.color.home_content_background') : $r('app.color.home_content_background_md')) : Color.White) + .width(CommonConstants.FULL_PERCENT) + // [End home_content_build] + .padding({ bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPE && this.currentWidthBreakpoint === + BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_navigation') : 0 }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/HomeHeader.ets b/MultiVideoApplication/features/home/src/main/ets/view/HomeHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e9d393238b3be688eca47d10b497abd400f3f6b --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/HomeHeader.ets @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { getTabIndex } from './CommonView'; + +@Component +export struct HomeHeader { + @State isShowingBorder: boolean = false; + @Link isSearching: boolean; + @StorageLink('scrollHeight') scrollHeight: number = 0; + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + // [Start home_header_build] + build() { + // [Start home_header] + Column() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[2], + lg: BreakpointConstants.GRID_COLUMN_SPANS[2] + } + }) { + this.TopTabBar() + } + .padding({ + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : $r('app.float.search_top_padding_top') + }) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.search_top_height') : + $r('app.float.search_top_height_more')) + + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[3], + lg: BreakpointConstants.GRID_COLUMN_SPANS[3] + } + }) { + this.searchBar() + } + .padding({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === + CommonConstants.DEVICE_TYPE ? 0 : $r('app.float.search_top_padding_top') }) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === + CommonConstants.DEVICE_TYPE ? $r('app.float.search_top_height') : $r('app.float.search_top_height_more')) + } + // The background color of the top tab bar is changed during the slide-down process. + .backgroundColor(this.scrollHeight >= new BreakpointType(HomeConstants.BACKGROUND_CHANGE_HEIGHT[0], + HomeConstants.BACKGROUND_CHANGE_HEIGHT[1], HomeConstants.BACKGROUND_CHANGE_HEIGHT[2]) + .getValue(this.currentWidthBreakpoint) && this.currentTopIndex === 2 ? $r('app.color.home_content_background') : + Color.Transparent) + } + .width(CommonConstants.FULL_PERCENT) + // [End home_header] + } + // [End home_header_build] + + @Builder + // [Start home_header_tap_bar] + TopTabBar() { + Row() { + Column() { + List() { + ForEach(HomeConstants.TOP_TOPIC_LIST, (item: string, index: number) => { + // [Start home_header_tap_bar] + ListItem() { + Text(item) + .fontSize(this.currentTopIndex === index ? $r('app.float.search_tab_font_selected') : + $r('app.float.search_tab_font')) + .fontWeight(this.currentTopIndex === index ? CommonConstants.FONT_WEIGHT_700 : + CommonConstants.FONT_WEIGHT_500) + .width(this.currentTopIndex === index ? $r('app.float.top_text_width_selected') : + $r('app.float.top_text_width')) + .textAlign(TextAlign.Center) + .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .lineHeight(index === this.currentTopIndex ? $r('app.float.top_tab_list_height_selected') : + $r('app.float.top_tab_list_height')) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) + .borderRadius($r('app.float.text_focus_radius')) + } + .align(Alignment.Center) + .margin({ + top: this.currentTopIndex === index ? $r('app.float.top_tab_list_top_selected') : + $r('app.float.top_tab_list_top'), + bottom: this.currentTopIndex === index ? $r('app.float.top_tab_list_bottom_selected') : + $r('app.float.top_tab_list_bottom') + }) + .padding({ + left: new BreakpointType(8, 12, 18).getValue(this.currentWidthBreakpoint), + right: new BreakpointType(8, 12, 18).getValue(this.currentWidthBreakpoint) + }) + .onClick(() => { + this.currentTopIndex = index; + this.scrollHeight = 0; + }) + // [End home_header_tap_bar] + }, (item: number, index: number) => index + JSON.stringify(item)) + } + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[1])) + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .padding({ left: $r('app.float.search_top_padding') }) + } + .alignItems(HorizontalAlign.Center) + .layoutWeight(1) + // [Start home_header_tap_bar] + Image($r('app.media.ic_public_more')) + .width($r('app.float.top_tab_img_size')) + .height($r('app.float.top_tab_img_size')) + .margin({ + left: $r('app.float.top_tab_img_margin'), + right: $r('app.float.top_tab_img_margin') + }) + .fillColor(this.currentTopIndex === 2 ? Color.White : Color.Black) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.Visible : Visibility.None) + // [Start home_header_tap_bar] + } + .height($r('app.float.top_bar_height')) + .width(CommonConstants.FULL_PERCENT) + } + // [End home_header_tap_bar] + // [Start home_header_search_bar] + @Builder + searchBar() { + Row() { + Stack({ alignContent: Alignment.Start }) { + // [[StartExclude home_header_search_bar] + TextInput({ placeholder: HomeConstants.SEARCH_PLACEHOLDER }) + .placeholderFont({ + size: $r('app.float.search_input_font'), + weight: FontWeight.Normal + }) + .placeholderColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) + .height($r('app.float.search_input_height')) + .fontSize($r('app.float.search_input_font')) + .padding({ + left: $r('app.float.search_input_left'), + right: $r('app.float.search_input_right') + }) + .width(CommonConstants.FULL_PERCENT) + .onClick(() => { + this.isSearching = true; + }) + .onSubmit((enterKey: EnterKeyType) => { + if (enterKey === EnterKeyType.Go) { + this.isSearching = true; + } + }) + .enterKeyType(EnterKeyType.Go) + .enableKeyboardOnFocus(false) + .backgroundColor(this.currentTopIndex === 2 ? $r('app.color.search_bar_background') : '') + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[1])) + + // Search image. + Image(this.currentTopIndex === 2 ? $r("app.media.ic_public_search_white") : + $r('app.media.ic_public_search')) + .width($r('app.float.search_img_size')) + .height($r('app.float.search_img_size')) + .margin({ left: $r('app.float.search_img_left') }) + // [EndExclude home_header_search_bar] + } + // [StartExclude home_header_search_bar] + .alignSelf(ItemAlign.Center) + .layoutWeight(1) + // [EndExclude home_header_search_bar] + // [StartExclude home_header_search_bar] + // History image. + Image(this.currentTopIndex === 2 ? $r('app.media.ic_public_history_white') : $r('app.media.ic_public_history')) + .width($r('app.float.history_img_size')) + .height($r('app.float.history_img_size')) + .margin({ left: $r('app.float.history_img_left') }) + + Image(this.currentTopIndex === 2 ? $r('app.media.ic_public_more_white') : $r('app.media.ic_public_more')) + .width($r('app.float.history_img_size')) + .height($r('app.float.history_img_size')) + .margin({ left: $r('app.float.history_img_left') }) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.None : Visibility.Visible) + // [EndExclude home_header_search_bar] + } + .padding({ + left: $r('app.float.search_top_padding'), + right: $r('app.float.search_top_padding') + }) + .justifyContent(FlexAlign.Center) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + // [End home_header_search_bar] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/IconView.ets b/MultiVideoApplication/features/home/src/main/ets/view/IconView.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a529e7aa2eefe3dc3baeb87a17cddaf6728cbd9 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/IconView.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { IconViewModel, VideoIcon } from '../viewmodel/IconViewModel'; +import { getTabIndex } from './CommonView'; + +@Component +export struct IconView { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + private iconList: VideoIcon[] = new IconViewModel().getIconList(); + + build() { + Column() { + List({ space: this.getSpace(this.windowWidth, this.currentWidthBreakpoint) }) { + ForEach(this.iconList, (item: VideoIcon, index: number) => { + ListItem() { + Column() { + Image(item.getImage()) + .width($r('app.float.icon_img_size')) + .height($r('app.float.icon_img_size')) + .margin({ bottom: $r('app.float.icon_img_bottom_margin') }) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) + .borderRadius($r('app.float.icon_img_radius')) + + Text(item.getName()) + .fontSize($r('app.float.icon_list_font_size')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.icon_list_font_height')) + .fontColor(this.currentTopIndex === 2 ? Color.White : Color.Black) + } + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + .height($r('app.float.icon_list_height')) + } + .padding({ + right: index === this.iconList.length - 1 ? this.getSpace(this.windowWidth, this.currentWidthBreakpoint) / 2 : 0 + }) + }, (item: VideoIcon) => JSON.stringify(item)) + } + .clip(false) + .listDirection(Axis.Horizontal) + .scrollBar(BarState.Off) + .scrollSnapAlign(ScrollSnapAlign.START) + .edgeEffect(EdgeEffect.None) + .chainAnimation(true) + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[3])) + .width(CommonConstants.FULL_PERCENT) + } + .padding({ + left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint) + }) + .margin({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.icon_list_column_margin_lg') : 0 + }) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + Visibility.None : Visibility.Visible) + } + + getSpace(windowWidth: number, currentWidthBreakpoint: string): number { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = px2vp(windowWidth) - (new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) / + HomeConstants.TWO) - getContext(this).resourceManager.getNumber($r('app.float.icon_img_size').id) / 2; + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + result = (result - HomeConstants.ICONVIEW_ITEM_WIDTH[0] * CommonConstants.FOUR) / CommonConstants.FOUR; + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result = (result - HomeConstants.ICONVIEW_ITEM_WIDTH[1] * HomeConstants.SIX) / HomeConstants.SIX; + } else { + result = (result - HomeConstants.LG_SIDEBAR_WIDTH - HomeConstants.ICONVIEW_ITEM_WIDTH[2] * HomeConstants.EIGHT) / + HomeConstants.EIGHT; + } + return result; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/NewVideoRelease.ets b/MultiVideoApplication/features/home/src/main/ets/view/NewVideoRelease.ets new file mode 100644 index 0000000000000000000000000000000000000000..031e2279a789e5bab2493ea9e2bcb8aa7ff8e20f --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/NewVideoRelease.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { VideoImage, VideoImgViewModel } from '../viewmodel/VideoImgViewModel'; +import { getTabIndex,SubtitleComponent,VideoContent,VideoImgComponent, VideoImgPlay, VideoImgRating, VideoTitle } from + './CommonView'; + +@Component +export struct NewVideoRelease { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + private newVideoImgList: VideoImage[] = new VideoImgViewModel().getNewVideoImgList(); + + build() { + Column() { + SubtitleComponent({ title: HomeConstants.HOME_SUB_TITLES[0] }) + .margin({ top: $r('app.float.sub_title_row_margin') }) + + // Video grid. + Grid() { + ForEach(this.newVideoImgList, (item: VideoImage, index: number) => { + GridItem() { + Column() { + Stack({ alignContent: Alignment.Bottom }) { + VideoImgComponent({ imgSrc:item.getImgSrc(), index: index }) + VideoImgPlay() + VideoImgRating({ rating: item.getRating() }) + } + .height(new BreakpointType($r('app.float.new_video_height_sm'), $r('app.float.new_video_height_md'), + $r('app.float.new_video_height_lg')).getValue(this.currentWidthBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .aspectRatio(HomeConstants.NEW_VIDEO_ASPECT_RATIO) + + VideoTitle({ title: item.getTitle() }) + VideoContent({ content: item.getContent() }) + } + .alignItems(HorizontalAlign.Start) + } + }, (item: VideoImage, index: number) => index + JSON.stringify(item)) + } + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[5])) + .padding({ + left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + top: $r('app.float.sub_title_row_margin'), + bottom: $r('app.float.sub_title_row_margin') + }) + .columnsTemplate(new BreakpointType(CommonConstants.VIDEO_GRID_COLUMNS[1], CommonConstants.VIDEO_GRID_COLUMNS[3], + CommonConstants.VIDEO_GRID_COLUMNS[4]).getValue(this.currentWidthBreakpoint)) + .rowsTemplate(HomeConstants.NEW_VIDEO_ROWS_TEMPLATE) + .width(CommonConstants.FULL_PERCENT) + .columnsGap($r('app.float.new_video_columns_gap')) + .height(this.getNewVideoHeight(this.currentWidthBreakpoint, this.windowWidth)) + } + .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 }) + } + + getNewVideoHeight(currentWidthBreakpoint: string, windowWidth: number): string { + let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint); + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = result - HomeConstants.LG_SIDEBAR_WIDTH; + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * HomeConstants.SIX) / HomeConstants.SEVEN; + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * CommonConstants.FOUR) / HomeConstants.FIVE; + } else { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * HomeConstants.TWO) / CommonConstants.THREE; + } + return (result / HomeConstants.NEW_VIDEO_ASPECT_RATIO + HomeConstants.NEW_VIDEO_DESCRIPTION_HEIGHT + + HomeConstants.HEIGHT_UNIT); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/PreviousVideo.ets b/MultiVideoApplication/features/home/src/main/ets/view/PreviousVideo.ets new file mode 100644 index 0000000000000000000000000000000000000000..b05b84f149ddceea15b2f69bea090949ffb2e098 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/PreviousVideo.ets @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, VideoNavPathStack } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { VideoImage, VideoImgViewModel } from '../viewmodel/VideoImgViewModel'; +import { PreviousVideoUtil } from '../utils/PreviousVideoUtil'; +import { getTabIndex, SubtitleComponent } from './CommonView'; + +@Component +export struct PreviousVideo { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + @State previousVideoImgListTwo: VideoImage[] = new VideoImgViewModel().getPreviousVideoTwo(this.currentWidthBreakpoint); + @Consume('pageInfo') pageInfo: VideoNavPathStack; + private previousVideoImgListOne: VideoImage[] = new VideoImgViewModel().getPreviousVideoOne(); + + build() { + Column() { + SubtitleComponent({ title: HomeConstants.HOME_SUB_TITLES[2] }) + + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[1] + }, + gutter: $r('app.float.grid_row_gutter') + }) { + ForEach(this.previousVideoImgListOne, (item: VideoImage, index: number) => { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[1], + lg: BreakpointConstants.GRID_COLUMN_SPANS[3] + } + }) { + Row() { + Image(item.getImgSrc()) + .objectFit(ImageFit.Fill) + .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') }) + .layoutWeight(CommonConstants.THREE) + .height(CommonConstants.FULL_PERCENT) + .borderRadius($r('app.float.banner_img_border_radius')) + + Column() { + Text(item.getTitle()) + .fontSize(new BreakpointType($r('app.float.previous_one_title_font_sm'), + $r('app.float.previous_one_title_font_md'), $r('app.float.previous_one_title_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Text(item.getContent()) + .fontSize(new BreakpointType($r('app.float.previous_one_content_font_sm'), + $r('app.float.previous_one_content_font_md'), $r('app.float.previous_one_content_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .fontWeight(FontWeight.Normal) + .margin({ top: $r('app.float.previous_one_content_margin') }) + .maxLines(1) + Text(item.getOtherInfo()) + .fontSize(new BreakpointType($r('app.float.previous_one_content_font_sm'), + $r('app.float.previous_one_content_font_md'), $r('app.float.previous_one_content_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .fontWeight(FontWeight.Normal) + .margin({ top: $r('app.float.previous_one_content_margin') }) + .maxLines(1) + + Row() { + Button(index === 0 ? HomeConstants.HOME_BUTTON_TEXT[1] : HomeConstants.HOME_BUTTON_TEXT[2]) + .borderRadius($r('app.float.previous_one_button_radius')) + .backgroundColor($r('app.color.previous_one_button_origin')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_one_button_font_lg') : $r('app.float.previous_one_button_font')) + .fontColor(Color.White) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_one_button_height_lg') : $r('app.float.previous_one_button_height')) + .layoutWeight(1) + .groupDefaultFocus(index === 0 ? true : false) + .onClick(() => { + this.pageInfo.setPageName(CommonConstants.PAGE_NAMES[1]); + this.pageInfo.pushPath({ name: CommonConstants.PAGE_NAMES[1] }); + }) + + Blank() + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD ? + $r('app.float.previous_blank_width_md') : $r('app.float.previous_blank_width')) + + Button(HomeConstants.HOME_BUTTON_TEXT[3]) + .borderRadius($r('app.float.previous_one_button_radius')) + .backgroundColor($r('app.color.button_background')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_one_button_font_lg') : $r('app.float.previous_one_button_font')) + .fontColor($r('app.color.previous_one_button_origin')) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_one_button_height_lg') : $r('app.float.previous_one_button_height')) + .layoutWeight(1) + } + .width(CommonConstants.FULL_PERCENT) + .alignItems(VerticalAlign.Bottom) + .layoutWeight(1) + } + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + .layoutWeight(CommonConstants.FOUR) + } + .aspectRatio(CommonConstants.PREVIOUS_ONE_ROW_RATIO) + .width(CommonConstants.FULL_PERCENT) + .padding({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_row_padding_sm') : $r('app.float.previous_one_row_padding'), + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_row_padding_sm') : $r('app.float.previous_one_row_padding'), + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_row_padding_sm') : $r('app.float.previous_one_row_padding'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_row_padding_sm') : $r('app.float.previous_one_row_padding') + }) + .backgroundColor($r('app.color.home_component_background')) + .borderRadius($r('app.float.card_radius')) + } + }, (item: VideoImage, index: number) => index + JSON.stringify(item)) + + ForEach(this.previousVideoImgListTwo, (item: VideoImage, index: number) => { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[6], + md: BreakpointConstants.GRID_COLUMN_SPANS[4], + lg: BreakpointConstants.GRID_COLUMN_SPANS[4] + } + }) { + Column() { + Image(item.getImgSrc()) + .width(CommonConstants.FULL_PERCENT) + .aspectRatio(PreviousVideoUtil.getImgAspectRatio(this.currentWidthBreakpoint, index)) + .objectFit(ImageFit.Fill) + .focusable(true) + .borderRadius({ + topLeft: $r('app.float.previous_two_radius'), + topRight: $r('app.float.previous_two_radius') + }) + + Column() { + Text(item.getTitle()) + .fontWeight(FontWeight.Normal) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_title_font_lg') : $r('app.float.previous_two_title_font')) + .maxLines(1) + .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_title_line_lg') : $r('app.float.previous_two_title_line')) + Text(item.getContent()) + .fontWeight(FontWeight.Normal) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_content_font_lg') : $r('app.float.previous_two_content_font')) + .margin({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_content_margin_lg') : $r('app.float.previous_two_content_margin') }) + .opacity(CommonConstants.TEXT_OPACITY[0]) + .maxLines(1) + .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_content_line_lg') : $r('app.float.previous_two_content_line')) + } + .alignItems(HorizontalAlign.Start) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_column_height_lg') : $r('app.float.previous_two_column_height')) + .width(CommonConstants.FULL_PERCENT) + .padding({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_column_padding_lg') : $r('app.float.previous_two_column_padding'), + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_column_bottom_lg') : $r('app.float.previous_two_column_bottom'), + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_column_padding_lg') : $r('app.float.previous_two_column_padding'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_column_padding_lg') : $r('app.float.previous_two_column_padding') + }) + } + .translate({ y: (((index === 2) || (index === 3)) && (this.currentWidthBreakpoint === + BreakpointConstants.BREAKPOINT_MD)) ? HomeConstants.PREVIOUS_TWO_TRANSLATE_MD : '0' }) + .backgroundColor($r('app.color.home_component_background')) + .borderRadius($r('app.float.previous_two_radius')) + } + }, (item: VideoImage, index: number) => index + JSON.stringify(item)) + } + .onBreakpointChange((breakPoints) => { + this.previousVideoImgListTwo = new VideoImgViewModel().getPreviousVideoTwo(breakPoints); + }) + .padding({ + left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint)}) + .margin({ top: $r('app.float.main_daily_margin') }) + } + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[8])) + .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/RecommendedVideo.ets b/MultiVideoApplication/features/home/src/main/ets/view/RecommendedVideo.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ec3aa93263f06740d2cca44cef23ea3509cba74 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/RecommendedVideo.ets @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { componentUtils } from '@kit.ArkUI'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType, Logger, WindowUtil } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; +import { VideoImage, VideoImgViewModel } from '../viewmodel/VideoImgViewModel'; +import { getTabIndex, VideoContent, VideoImgRating, VideoTitle } from './CommonView'; +import { RightClickMenu, VideoDialog } from './VideoDialog'; + +@Component +export struct RecommendedVideo { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('videoGridColumn') videoGridColumn: string = CommonConstants.VIDEO_GRID_COLUMNS[0]; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + @State isShowingRecommendBorder: boolean = false; + @State currentRecommendFocusIndex: number = 0; + @State videoImgList: VideoImage[] = new VideoImgViewModel().getVideoImgList(); + private videoDialogController?: CustomDialogController; + private windowUtil?: WindowUtil; + // [Start recommended_video] + build() { + // Video grid layout. + Grid() { + ForEach(this.videoImgList, (item: VideoImage, index: number) => { + GridItem() { + Column() { + // [Start recommended_video_stack] + Stack({ alignContent: Alignment.Center }) { + // [StartExclude recommended_video] + Image(item.getImgSrc()) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) + .objectFit(ImageFit.Fill) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .draggable(false) + .borderRadius($r('app.float.banner_focus_radius')) + .id(JSON.stringify(item)) + Column() { + VideoImgRating({ rating: item.getRating() }) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .alignItems(HorizontalAlign.End) + .justifyContent(FlexAlign.End) + // [EndExclude recommended_video] + } + // [StartExclude recommended_video_stack] + .width(CommonConstants.FULL_PERCENT) + .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) + // [StartExclude recommended_video] + .focusable(true) + // The width and height vary with the container assembly and the aspect ratio remains unchanged. + .hoverEffect(HoverEffect.Scale) + // [EndExclude recommended_video] + + .gesture( + LongPressGesture({ repeat: false }) + .onAction(() => { + if (index !== 0) { + Logger.info(`Please long press the first image`); + return; + } + // Obtains all attributes of a component. + let modePosition: componentUtils.ComponentInfo = + componentUtils.getRectangleById(JSON.stringify(item)); + let windowOffset = modePosition.windowOffset; + let size = modePosition.size; + // Obtains the height of the component from the top. + let rectTop: number = px2vp(windowOffset.y); + let rectTop2: number = px2vp(windowOffset.y + Math.floor(size.height)); + // Obtains the width of the component from the left. + let rectLeft: number = px2vp(windowOffset.x); + let topHeightNeeded: number = new BreakpointType(HomeConstants.VIDEO_DIALOG_HEIGHTS[0], + HomeConstants.VIDEO_DIALOG_HEIGHTS[1], HomeConstants.VIDEO_DIALOG_HEIGHTS[2]) + .getValue(this.currentWidthBreakpoint) + rectTop - rectTop2; + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + topHeightNeeded += HomeConstants.HOME_HEADER_HEIGHT_SM; + } + let dialogYOffset: number; + // Adaptive pop-up window expansion direction. + if (topHeightNeeded < rectTop) { + dialogYOffset = rectTop2 - new BreakpointType(HomeConstants.VIDEO_DIALOG_HEIGHTS[0], + HomeConstants.VIDEO_DIALOG_HEIGHTS[1], HomeConstants.VIDEO_DIALOG_HEIGHTS[2]) + .getValue(this.currentWidthBreakpoint); + } else { + dialogYOffset = rectTop; + } + this.windowUtil = WindowUtil.getInstance(); + let isLayoutFullScreen: boolean = true; + let mainWindow = this.windowUtil!.getMainWindow(); + isLayoutFullScreen = mainWindow!.getWindowProperties().isLayoutFullScreen; + // Subtract the width and height of the window in the PC/2in1 device. + if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE && !isLayoutFullScreen) { + dialogYOffset -= HomeConstants.WINDOW_UNDEFINED_TOP; + rectLeft -= HomeConstants.WINDOW_UNDEFINED_LEFT; + } else { + Logger.info(`No need to subtract extra height`); + } + this.videoDialogController = new CustomDialogController({ + builder: VideoDialog(), + autoCancel: true, + customStyle: true, + alignment: DialogAlignment.TopStart, + offset: { + dx: rectLeft, + dy: dialogYOffset + } + }); + // Display the customized pop-up window to play the video. + this.videoDialogController.open(); + })) + // [EndExclude recommended_video_stack] + .bindContextMenu(RightClickMenu(this.currentWidthBreakpoint), ResponseType.RightClick) + // [End recommended_video_stack] + + VideoTitle({ title: item.getTitle() }) + VideoContent({ content: item.getContent() }) + } + .alignItems(HorizontalAlign.Start) + } + }, (item: VideoImage, index: number) => index + JSON.stringify(item)) + } + // [StartExclude recommended_video] + .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[4])) + .editMode(false) + // Sets the number of grid layout columns and evenly divides the width. + .columnsTemplate(this.videoGridColumn) + .rowsTemplate(CommonConstants.VIDEO_GRID_COLUMNS[0]) + .width(CommonConstants.FULL_PERCENT) + .rowsGap($r('app.float.video_grid_gap')) + .columnsGap($r('app.float.video_grid_gap')) + // Dynamically calculates the total height based on the following numbers of breakpoints. + .height(this.getGridHeight(this.videoGridColumn, this.currentWidthBreakpoint, this.windowWidth)) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + new BreakpointType($r('app.float.home_recommended_padding_sm'), $r('app.float.home_recommended_padding_md'), + $r('app.float.home_recommended_padding_lg')).getValue(this.currentWidthBreakpoint) : + new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), + top: $r('app.float.recommended_video_padding_top'), + bottom: $r('app.float.recommended_video_padding_bottom') + }) + // Zooming and pinching functions of the grid. + // [EndExclude recommended_video] + .gesture(PinchGesture({ fingers: 2 }).onActionUpdate((event: GestureEvent) => { + if (event.scale > 1 && this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM) { + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + animateTo({ + duration: HomeConstants.ANIMATION_DURATION + }, () => { + this.videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[1]; + }) + } else { + animateTo({ + duration: HomeConstants.ANIMATION_DURATION + }, () => { + this.videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[2]; + }) + } + } else if (event.scale < 1 && this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM) { + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + animateTo({ + duration: HomeConstants.ANIMATION_DURATION + }, () => { + this.videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[2]; + }) + } else { + animateTo({ + duration: HomeConstants.ANIMATION_DURATION + }, () => { + this.videoGridColumn = CommonConstants.VIDEO_GRID_COLUMNS[3]; + }) + } + } else { + Logger.info(`Two-finger operation is not supported`); + } + })) + } + + getGridHeight(videoGridColumn: string, currentWidthBreakpoint: string, windowWidth: number): string { + // Obtain the window width and subtract the blank parts on both sides. + let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint); + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + result = result - HomeConstants.LG_SIDEBAR_WIDTH; + } + // Calculate the width of a single image based on the number of grid columns. + if (videoGridColumn === CommonConstants.VIDEO_GRID_COLUMNS[0]) { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * 1) / HomeConstants.TWO; + } else if (videoGridColumn === CommonConstants.VIDEO_GRID_COLUMNS[1]) { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * 2) / CommonConstants.THREE; + } else if (videoGridColumn === CommonConstants.VIDEO_GRID_COLUMNS[2]) { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * 3) / CommonConstants.FOUR; + } else { + result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * 4) / HomeConstants.FIVE; + } + // Calculate the height of a single image, title, and content, and calculate the total height of the grid layout. + return result / HomeConstants.VIDEO_DIALOG_ASPECT_RATIO * HomeConstants.TWO + + HomeConstants.VIDEO_GRID_DESCRIPTION_HEIGHT + HomeConstants.HEIGHT_UNIT; + } +} +// [End recommended_video] \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/view/VideoDialog.ets b/MultiVideoApplication/features/home/src/main/ets/view/VideoDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d5a19d5dad128c71feac118838403621b44771d --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/view/VideoDialog.ets @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { resourceManager } from '@kit.LocalizationKit'; +import { common } from '@kit.AbilityKit'; +import { media } from '@kit.MediaKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType, Logger } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Builder function MenuItemFunction(img: Resource, text: ResourceStr) { + Row() { + Image(img) + .width($r('app.float.dialog_icon_size')) + .height($r('app.float.dialog_icon_size')) + .margin({ right: $r('app.float.dialog_icon_margin') }) + Text(text) + .layoutWeight(1) + .fontSize($r('app.float.dialog_text_font')) + .fontWeight(FontWeight.Normal) + } + .height($r('app.float.dialog_menu_row_height')) +} + +@Builder export function RightClickMenu(currentWidthBreakpoint: string) { + Column() { + MenuItemFunction($r('app.media.ic_public_view_list'), HomeConstants.VIDEO_DIALOG_OPTIONS[0]) + MenuItemFunction($r('app.media.ic_public_highlights'), HomeConstants.VIDEO_DIALOG_OPTIONS[1]) + MenuItemFunction($r('app.media.ic_public_favor'), HomeConstants.VIDEO_DIALOG_OPTIONS[2]) + } + .borderRadius($r('app.float.dialog_text_radius')) + .backgroundColor(Color.White) + .width(currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.dialog_text_col_width_lg') : + $r('app.float.dialog_text_col_width')) + .padding({ + left: $r('app.float.dialog_text_col_padding'), + right: $r('app.float.dialog_text_col_padding') + }) +} + +@CustomDialog +export struct VideoDialog { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private xComponentController: XComponentController = new XComponentController(); + private surfaceId: string = ''; + private avPlayer?: media.AVPlayer; + private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; + private url?: resourceManager.RawFileDescriptor; + private playState: boolean = true; + private controller?: CustomDialogController; + private onError: (err: BusinessError) => void = (err: BusinessError) => { + Logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer!.reset(); + } + private onStateChange: (state: media.AVPlayerState) => void = async (state: media.AVPlayerState) => { + if (this.avPlayer === undefined) { + Logger.error(`AvPlayer is undefined`); + return; + } + switch (state) { + case CommonConstants.AV_PLAYER_IDLE_STATE: + this.url = await this.context.resourceManager.getRawFd(CommonConstants.PRODUCT_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + Logger.info('AVPlayer state idle called.'); + break; + case CommonConstants.AV_PLAYER_INITIALIZED_STATE: + // This status is reported after the AVPlayer sets the playback source. + Logger.info('AVPlayer initialized called.'); + this.avPlayer.surfaceId = this.surfaceId; + this.avPlayer.prepare().then(() => { + Logger.info('AVPlayer prepare succeeded.'); + }, (err: BusinessError) => { + Logger.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer!.reset(); + }); + break; + case CommonConstants.AV_PLAYER_PREPARED_STATE: + // Report the state machine after the prepare interface is successfully invoked. + this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; + Logger.info('AVPlayer state prepared called.'); + this.avPlayer.play(); + break; + case CommonConstants.AV_PLAYER_PLAYING_STATE: + // Trigger the state machine to report after the play interface is successfully invoked. + Logger.info('AVPlayer state playing called.'); + this.playState = true; + break; + case CommonConstants.AV_PLAYER_PAUSED_STATE: + // Trigger the state machine to report after the pause function is successfully invoked. + Logger.info('AVPlayer state paused called.'); + this.playState = false; + break; + case CommonConstants.AV_PLAYER_COMPLETED_STATE: + // Trigger the state machine to report after the playback ends. + Logger.info('AVPlayer state completed called.'); + this.avPlayer.stop(); + break; + case CommonConstants.AV_PLAYER_STOPPED_STATE: + // Trigger the state machine to report after the stop interface is successfully invoked. + Logger.info('AVPlayer state stopped called.'); + break; + case CommonConstants.AV_PLAYER_RELEASE_STATE: + Logger.info('AVPlayer state released called.'); + break; + case CommonConstants.AV_PLAYER_ERROR_STATE: + Logger.error('AVPlayer state error called.'); + break; + default: + Logger.info('AVPlayer state unknown called.'); + break; + } + } + + aboutToAppear() { + this.createAvPlayer(); + } + + aboutToDisappear() { + try { + this.avPlayer!.off('error'); + this.avPlayer!.off('stateChange'); + } catch (exception) { + Logger.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); + } + this.avPlayer!.release(); + } + + build() { + Column() { + Column() { + XComponent({ + type: XComponentType.SURFACE, + controller: this.xComponentController + }) + .borderRadius($r('app.float.x_component_radius')) + .onLoad(() => { + this.surfaceId = this.xComponentController.getXComponentSurfaceId(); + }) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + .margin({ bottom: $r('app.float.dialog_col_margin') }) + .height(new BreakpointType($r('app.float.dialog_col_height_sm'), $r('app.float.dialog_col_height_md'), + $r('app.float.dialog_col_height_lg')).getValue(this.currentWidthBreakpoint)) + .width(new BreakpointType($r('app.float.dialog_col_width_sm'), $r('app.float.dialog_col_width_md'), + $r('app.float.dialog_col_width_lg')).getValue(this.currentWidthBreakpoint)) + .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) + .onClick(() => { + if (this.avPlayer!.state === CommonConstants.AV_PLAYER_STOPPED_STATE) { + this.avPlayer!.prepare(); + return; + } + if (!this.playState) { + this.avPlayer!.play(); + } else { + this.avPlayer!.pause(); + } + }) + + RightClickMenu(this.currentWidthBreakpoint) + } + .alignItems(HorizontalAlign.Start) + } + + async createAvPlayer(): Promise { + this.avPlayer = await media.createAVPlayer(); + // Entering the idle state. + this.url = await this.context.resourceManager.getRawFd(CommonConstants.PRODUCT_VIDEO_NAME); + this.avPlayer.fdSrc = this.url; + this.setAVPlayerCallback(); + // Initialize the playback status. + this.playState = false; + } + + // Registering the avplayer callback function. + setAVPlayerCallback(): void { + this.avPlayer!.on('error', this.onError); + // Callback function for state machine changes. + this.avPlayer!.on('stateChange', this.onStateChange); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/viewmodel/BannerViewModel.ets b/MultiVideoApplication/features/home/src/main/ets/viewmodel/BannerViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..59cf99e5a7b54b960dfbe4ff92879b3ad08a5cab --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/viewmodel/BannerViewModel.ets @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +export class BannerViewModel { + private bannerList: Banner[] = []; + private bannerImgList: BannerImg[] = new BannerImgModel().getBannerImgList(); + private bannerDescriptionList: BannerDescription[] = new BannerDescriptionModel().getBannerDescriptionList(); + + constructor() { + this.bannerList.push(new Banner(this.bannerImgList[0], this.bannerDescriptionList[3])); + this.bannerList.push(new Banner(this.bannerImgList[2], this.bannerDescriptionList[1])); + this.bannerList.push(new Banner(this.bannerImgList[1], this.bannerDescriptionList[0])); + this.bannerList.push(new Banner(this.bannerImgList[2], this.bannerDescriptionList[1])); + this.bannerList.push(new Banner(this.bannerImgList[3], this.bannerDescriptionList[2])); + } + + getBannerList(): Banner[] { + return this.bannerList; + } +} + +class BannerImgModel { + private BannerImgList: BannerImg[] = []; + + constructor() { + this.BannerImgList.push(new BannerImg($r("app.media.ic_banner_1"), $r('app.media.ic_banner_1_sm'), + new BreakpointType($r('app.float.banner_height_sm'), $r('app.float.banner_height_md'), + $r('app.float.banner_height_lg')))); + this.BannerImgList.push(new BannerImg($r('app.media.ic_banner_2'), $r('app.media.ic_banner_2_sm'), + new BreakpointType($r('app.float.banner_height_sm'), $r('app.float.banner_height_md'), + $r('app.float.banner_height_lg')))); + this.BannerImgList.push(new BannerImg($r('app.media.ic_banner_3'), $r('app.media.ic_banner_3_sm'), + new BreakpointType($r('app.float.banner_height_sm'), $r('app.float.banner_height_md'), + $r('app.float.banner_height_lg')))); + this.BannerImgList.push(new BannerImg($r("app.media.ic_banner_4"), $r("app.media.ic_banner_4"), + new BreakpointType($r('app.float.banner_height_sm'), $r('app.float.banner_height_md'), + $r('app.float.banner_height_lg')))); + } + + getBannerImgList(): BannerImg[] { + return this.BannerImgList; + } +} + +class BannerDescriptionModel { + private bannerDescriptionList: BannerDescription[] = []; + + constructor() { + this.bannerDescriptionList.push(new BannerDescription(HomeConstants.BANNER_TEXT_1, + new BreakpointType([$r('app.float.banner_text_1_font_sm'), $r('app.float.banner_text_2_font_sm')], + [$r('app.float.banner_text_1_font_md'), $r('app.float.banner_text_2_font_md')], + [$r('app.float.banner_text_1_font_lg'), $r('app.float.banner_text_2_font_lg')]), + [CommonConstants.FONT_WEIGHT_700, CommonConstants.FONT_WEIGHT_500], + new BreakpointType([$r('app.float.banner_text_1_height_sm'), $r('app.float.banner_text_2_height_sm')], + [$r('app.float.banner_text_1_height_md'), $r('app.float.banner_text_2_height_md')], + [$r('app.float.banner_text_1_height_lg'), $r('app.float.banner_text_2_height_lg')]), + new BreakpointType([], [HomeConstants.BANNER_TEXT_1_LEFT_MD], []), new BreakpointType( + HomeConstants.BANNER_TEXT_1_TOP_SM, HomeConstants.BANNER_TEXT_1_TOP_MD, HomeConstants.BANNER_TEXT_1_TOP_LG), + new BreakpointType(true, false, true), new BreakpointType(false, false, false))); + this.bannerDescriptionList.push(new BannerDescription(HomeConstants.BANNER_TEXT_2, + new BreakpointType([$r('app.float.banner_text_1_font_sm'), $r('app.float.banner_text_2_font_sm')], + [$r('app.float.banner_text_1_font_md'), $r('app.float.banner_text_2_font_md')], + [$r('app.float.banner_text_1_font_lg'), $r('app.float.banner_text_2_font_lg')]), + [CommonConstants.FONT_WEIGHT_700, CommonConstants.FONT_WEIGHT_500], + new BreakpointType([$r('app.float.banner_text_1_height_sm'), $r('app.float.banner_text_2_height_sm')], + [$r('app.float.banner_text_1_height_md'), $r('app.float.banner_text_2_height_md')], + [$r('app.float.banner_text_1_height_lg'), $r('app.float.banner_text_2_height_lg')]), + new BreakpointType([], [HomeConstants.BANNER_TEXT_2_LEFT_MD], [HomeConstants.BANNER_TEXT_2_LEFT_LG]), + new BreakpointType(HomeConstants.BANNER_TEXT_2_TOP_SM, HomeConstants.BANNER_TEXT_2_TOP_MD, + HomeConstants.BANNER_TEXT_2_TOP_LG), new BreakpointType(true, false, false), + new BreakpointType(false, false, false))); + this.bannerDescriptionList.push(new BannerDescription(HomeConstants.BANNER_TEXT_3, + new BreakpointType([$r('app.float.banner_text_1_font_sm'), $r('app.float.banner_text_2_font_sm')], + [$r('app.float.banner_text_1_font_md'), $r('app.float.banner_text_2_font_md')], + [$r('app.float.banner_text_1_font_lg'), $r('app.float.banner_text_2_font_lg')]), + [CommonConstants.FONT_WEIGHT_700, CommonConstants.FONT_WEIGHT_500], + new BreakpointType([$r('app.float.banner_text_1_height_sm'), $r('app.float.banner_text_2_height_sm')], + [$r('app.float.banner_text_1_height_md'), $r('app.float.banner_text_2_height_md')], + [$r('app.float.banner_text_1_height_lg'), $r('app.float.banner_text_2_height_lg')]), + new BreakpointType([], [''], []), new BreakpointType([''], [], []), + new BreakpointType(true, true, true), new BreakpointType(true, true, true))); + this.bannerDescriptionList.push(new BannerDescription(HomeConstants.BANNER_TEXT_4, + new BreakpointType([$r('app.float.banner_text_1_font_sm'), $r('app.float.banner_text_2_font_sm')], + [$r('app.float.banner_text_1_font_md'), $r('app.float.banner_text_2_font_md')], + [$r('app.float.banner_text_1_font_lg'), $r('app.float.banner_text_2_font_lg')]), + [CommonConstants.FONT_WEIGHT_700, CommonConstants.FONT_WEIGHT_500], + new BreakpointType([$r('app.float.banner_text_1_height_sm'), $r('app.float.banner_text_2_height_sm')], + [$r('app.float.banner_text_1_height_md'), $r('app.float.banner_text_2_height_md')], + [$r('app.float.banner_text_1_height_lg'), $r('app.float.banner_text_2_height_lg')]), + new BreakpointType([], [''], []), new BreakpointType([''], [], []), + new BreakpointType(true, true, true), new BreakpointType(true, true, true))); + } + + getBannerDescriptionList(): BannerDescription[] { + return this.bannerDescriptionList; + } +} + +export class Banner { + /** + * Img of the banner. + */ + private bannerImg: BannerImg; + + /** + * Description of the banner. + */ + private description: BannerDescription; + + constructor(bannerImg: BannerImg, description: BannerDescription) { + this.bannerImg = bannerImg; + this.description = description; + } + + getBannerImg(): BannerImg { + return this.bannerImg; + } + + getDescription(): BannerDescription { + return this.description; + } +} + +class BannerDescription { + /** + * Text description. + */ + private description: ResourceStr[]; + + /** + * Font size of text. + */ + private fontSize: BreakpointType; + + /** + * Font weight of text. + */ + private fontWeight: number[]; + + /** + * Line height of text. + */ + private lineHeight: BreakpointType; + + /** + * Top position for text. + */ + private topPosition: BreakpointType; + + /** + * Left position for text. + */ + private leftPosition: BreakpointType; + + /** + * Whether text is horizontal center. + */ + private isLeftCenter: BreakpointType; + + /** + * Whether text is vertical center. + */ + private isTopCenter: BreakpointType; + + constructor(description: ResourceStr[], fontSize: BreakpointType, fontWeight: number[], + lineHeight: BreakpointType, leftPosition: BreakpointType, + topPosition: BreakpointType, isLeftCenter: BreakpointType, + isTopCenter: BreakpointType) { + this.description = description; + this.fontSize = fontSize; + this.fontWeight = fontWeight; + this.lineHeight = lineHeight; + this.leftPosition = leftPosition; + this.topPosition = topPosition; + this.isLeftCenter = isLeftCenter; + this.isTopCenter = isTopCenter; + } + + getDescription(): ResourceStr[] { + return this.description; + } + + getFontSize(): BreakpointType { + return this.fontSize; + } + + getFontWeight(): number[] { + return this.fontWeight; + } + + getLineHeight(): BreakpointType { + return this.lineHeight; + } + + getLeftPosition(): BreakpointType { + return this.leftPosition; + } + + getTopPosition(): BreakpointType { + return this.topPosition; + } + + getIsLeftCenter(): BreakpointType { + return this.isLeftCenter; + } + + getIsTopCenter(): BreakpointType { + return this.isTopCenter; + } +} + +class BannerImg { + /** + * Image src of the banner. + */ + private imgSrc: Resource; + + /** + * Image src of the banner for sm. + */ + private imgSrcSm: Resource; + + /** + * Height of the banner. + */ + private height: BreakpointType; + + constructor(imgSrc: Resource, imgSrcSm: Resource,height: BreakpointType) { + this.imgSrc = imgSrc; + this.imgSrcSm = imgSrcSm; + this.height = height; + } + + getImgSrc(): Resource { + return this.imgSrc; + } + + getImgSrcSm(): Resource { + return this.imgSrcSm; + } + + getHeight(): BreakpointType { + return this.height; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets b/MultiVideoApplication/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..80aa9a46faa6515e367851987f94ee6a6770eba8 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2023 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 class FooterTabViewModel { + private tabList: FooterTab[] = []; + + constructor() { + this.tabList.push(new FooterTab($r('app.string.tab_home'), $r("app.media.ic_tabs_home_normal"), + $r('app.media.ic_tabs_home_selected'), $r('app.media.ic_tabs_home_white'))); + this.tabList.push(new FooterTab($r('app.string.tab_development'), $r('app.media.ic_tabs_post_normal'), + $r('app.media.ic_tabs_post_selected'), $r('app.media.ic_tabs_post_white'))); + this.tabList.push(new FooterTab($r('app.string.tab_member'), $r('app.media.ic_tabs_vip_normal'), + $r('app.media.ic_tabs_vip_selected'), $r('app.media.ic_tabs_vip_white'))); + this.tabList.push(new FooterTab($r('app.string.tab_mine'), $r('app.media.ic_tabs_mine_normal'), + $r('app.media.ic_tabs_mine_selected'), $r('app.media.ic_tabs_mine_white'))); + } + + getTabList(): FooterTab[] { + return this.tabList; + } +} + +export class FooterTab { + /** + * Name of the tab. + */ + private name: Resource; + + /** + * Icon of the tab. + */ + private icon: Resource; + + /** + * Icon selected. + */ + private iconSelected: Resource; + + /** + * White icon. + */ + private iconWhite: Resource; + + constructor(name: Resource, icon: Resource, iconSelected: Resource, iconWhite: Resource) { + this.name = name; + this.icon = icon; + this.iconSelected = iconSelected; + this.iconWhite = iconWhite; + } + + getName(): Resource { + return this.name; + } + + getIcon(): Resource { + return this.icon; + } + + getIconSelected(): Resource { + return this.iconSelected; + } + + getIconWhite(): Resource { + return this.iconWhite; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/viewmodel/IconViewModel.ets b/MultiVideoApplication/features/home/src/main/ets/viewmodel/IconViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2b149a91b3764b423c8b3bc0170a61eb67fc42f --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/viewmodel/IconViewModel.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { HomeConstants } from '../constants/HomeConstants'; + +export class IconViewModel { + private iconList: VideoIcon[] = []; + + constructor() { + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[0], $r('app.media.icon_all'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[1], $r('app.media.icon_weekly_hot'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[2], $r('app.media.icon_free'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[3], $r('app.media.icon_classic'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[4], $r('app.media.icon_vip'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[5], $r('app.media.icon_kid'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[6], $r('app.media.icon_live'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[7], $r('app.media.icon_fitness'))); + this.iconList.push(new VideoIcon(HomeConstants.ICON_LIST[8], $r('app.media.icon_classes'))); + } + + getIconList(): VideoIcon[] { + return this.iconList; + } +} + +export class VideoIcon { + /** + * Name of the icon. + */ + private name: ResourceStr; + + /** + * Image of the icon. + */ + private image: Resource; + + constructor(name: ResourceStr, image: Resource) { + this.name = name; + this.image = image; + } + + getName(): ResourceStr { + return this.name; + } + + getImage(): Resource { + return this.image; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets b/MultiVideoApplication/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ad84f50a49e473eeca57ea9b6c3f5f8ff08c9dd --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '@ohos/commons'; +import { HomeConstants } from '../constants/HomeConstants'; + +export class VideoImgViewModel { + private videoImgList: VideoImage[] = []; + private newVideoImgList: VideoImage[] = []; + private dailyVideoImgList: VideoImage[] = []; + private mainDailyVideoImg: VideoImage; + private previousVideoImgListOne: VideoImage[] = []; + private previousVideoImgListTwo: VideoImage[] = []; + + constructor() { + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_1'), HomeConstants.VIDEO_GRID_RATES[0], + HomeConstants.VIDEO_GRID_NAMES[0], HomeConstants.VIDEO_GRID_CONTENTS[0], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_2'), HomeConstants.VIDEO_GRID_RATES[1], + HomeConstants.VIDEO_GRID_NAMES[1], HomeConstants.VIDEO_GRID_CONTENTS[1], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_3'), HomeConstants.VIDEO_GRID_RATES[2], + HomeConstants.VIDEO_GRID_NAMES[2], HomeConstants.VIDEO_GRID_CONTENTS[2], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_4'), HomeConstants.VIDEO_GRID_RATES[3], + HomeConstants.VIDEO_GRID_NAMES[3], HomeConstants.VIDEO_GRID_CONTENTS[3], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_5'), HomeConstants.VIDEO_GRID_RATES[4], + HomeConstants.VIDEO_GRID_NAMES[4], HomeConstants.VIDEO_GRID_CONTENTS[4], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_6'), HomeConstants.VIDEO_GRID_RATES[5], + HomeConstants.VIDEO_GRID_NAMES[5], HomeConstants.VIDEO_GRID_CONTENTS[5], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_7'), HomeConstants.VIDEO_GRID_RATES[6], + HomeConstants.VIDEO_GRID_NAMES[6], HomeConstants.VIDEO_GRID_CONTENTS[6], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_8'), HomeConstants.VIDEO_GRID_RATES[7], + HomeConstants.VIDEO_GRID_NAMES[7], HomeConstants.VIDEO_GRID_CONTENTS[7], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_9'), HomeConstants.VIDEO_GRID_RATES[8], + HomeConstants.VIDEO_GRID_NAMES[8], HomeConstants.VIDEO_GRID_CONTENTS[8], '')); + this.videoImgList.push(new VideoImage($r('app.media.ic_video_grid_10'), HomeConstants.VIDEO_GRID_RATES[9], + HomeConstants.VIDEO_GRID_NAMES[9], HomeConstants.VIDEO_GRID_CONTENTS[9], '')); + + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_1'), HomeConstants.NEW_VIDEO_RATES[0], + HomeConstants.NEW_VIDEO_NAMES[0], HomeConstants.NEW_VIDEO_CONTENTS[0], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_2'), HomeConstants.NEW_VIDEO_RATES[1], + HomeConstants.NEW_VIDEO_NAMES[1], HomeConstants.NEW_VIDEO_CONTENTS[1], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_3'), HomeConstants.NEW_VIDEO_RATES[2], + HomeConstants.NEW_VIDEO_NAMES[2], HomeConstants.NEW_VIDEO_CONTENTS[2], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_4'), HomeConstants.NEW_VIDEO_RATES[3], + HomeConstants.NEW_VIDEO_NAMES[3], HomeConstants.NEW_VIDEO_CONTENTS[3], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_5'), HomeConstants.NEW_VIDEO_RATES[4], + HomeConstants.NEW_VIDEO_NAMES[4], HomeConstants.NEW_VIDEO_CONTENTS[4], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_6'), HomeConstants.NEW_VIDEO_RATES[5], + HomeConstants.NEW_VIDEO_NAMES[5], HomeConstants.NEW_VIDEO_CONTENTS[5], '')); + this.newVideoImgList.push(new VideoImage($r('app.media.new_video_7'), HomeConstants.NEW_VIDEO_RATES[6], + HomeConstants.NEW_VIDEO_NAMES[6], HomeConstants.NEW_VIDEO_CONTENTS[6], '')); + + this.mainDailyVideoImg = new VideoImage($r('app.media.daily_video'), HomeConstants.MAIN_DAILY_VIDEO_RATE, + HomeConstants.MAIN_DAILY_VIDEO_NAME, HomeConstants.MAIN_DAILY_VIDEO_CONTENT, HomeConstants.MAIN_DAILY_VIDEO_MORE); + + this.dailyVideoImgList.push(new VideoImage($r('app.media.daily_video_1'), HomeConstants.DAILY_VIDEO_RATES[0], + HomeConstants.DAILY_VIDEO_NAMES[0], HomeConstants.DAILY_VIDEO_CONTENTS[0], '')); + this.dailyVideoImgList.push(new VideoImage($r('app.media.daily_video_2'), HomeConstants.DAILY_VIDEO_RATES[1], + HomeConstants.DAILY_VIDEO_NAMES[1], HomeConstants.DAILY_VIDEO_CONTENTS[1], '')); + this.dailyVideoImgList.push(new VideoImage($r('app.media.daily_video_3'), HomeConstants.DAILY_VIDEO_RATES[2], + HomeConstants.DAILY_VIDEO_NAMES[2], HomeConstants.DAILY_VIDEO_CONTENTS[2], '')); + this.dailyVideoImgList.push(new VideoImage($r('app.media.daily_video_4'), HomeConstants.DAILY_VIDEO_RATES[3], + HomeConstants.DAILY_VIDEO_NAMES[3], HomeConstants.DAILY_VIDEO_CONTENTS[3], '')); + + this.previousVideoImgListOne.push(new VideoImage($r('app.media.previous_video_1'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_ONE[0], HomeConstants.PREVIOUS_VIDEO_CONTENTS_ONE[0], + HomeConstants.PREVIOUS_VIDEO_MORE_ONE[0])); + this.previousVideoImgListOne.push(new VideoImage($r('app.media.previous_video_2'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_ONE[1], HomeConstants.PREVIOUS_VIDEO_CONTENTS_ONE[1], + HomeConstants.PREVIOUS_VIDEO_MORE_ONE[1])); + this.previousVideoImgListOne.push(new VideoImage($r('app.media.previous_video_3'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_ONE[2], HomeConstants.PREVIOUS_VIDEO_CONTENTS_ONE[2], + HomeConstants.PREVIOUS_VIDEO_MORE_ONE[2])); + + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_4'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[0], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[0], '')); + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_5'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[1], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[1], '')); + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_6'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[2], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[2], '')); + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_7'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[3], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[3], '')); + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_8'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[4], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[4], '')); + this.previousVideoImgListTwo.push(new VideoImage($r('app.media.previous_video_9'), '', + HomeConstants.PREVIOUS_VIDEO_NAMES_TWO[5], HomeConstants.PREVIOUS_VIDEO_CONTENTS_TWO[5], '')); + } + + getVideoImgList(): VideoImage[] { + return this.videoImgList; + } + + getNewVideoImgList(): VideoImage[] { + return this.newVideoImgList; + } + + getDailyVideoImgList(): VideoImage[] { + return this.dailyVideoImgList; + } + + getMainDailyVideoImg(): VideoImage { + return this.mainDailyVideoImg; + } + + getPreviousVideoOne(): VideoImage[] { + return this.previousVideoImgListOne; + } + + getPreviousVideoTwo(currentWidthBreakpoint: string): VideoImage[] { + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.previousVideoImgListTwo; + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.previousVideoImgListTwo.slice(1, 6); + } else { + return this.previousVideoImgListTwo.slice(0, 4); + } + } +} + +export class VideoImage { + /** + * Image src of the video. + */ + private imgSrc: Resource; + + /** + * Rating of the video. + */ + private rating: string; + + /** + * Title of the video. + */ + private title: ResourceStr; + + /** + * Content of the video. + */ + private content: ResourceStr; + + /** + * Other information of the video. + */ + private otherInfo: ResourceStr; + + constructor(imgSrc: Resource, rating: string, title: ResourceStr, content: ResourceStr, otherInfo: ResourceStr) { + this.imgSrc = imgSrc; + this.rating = rating; + this.title = title; + this.content = content; + this.otherInfo = otherInfo; + } + + getImgSrc(): Resource { + return this.imgSrc; + } + + getRating(): string { + return this.rating; + } + + getTitle(): ResourceStr { + return this.title; + } + + getContent(): ResourceStr { + return this.content; + } + + getOtherInfo(): ResourceStr { + return this.otherInfo; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/module.json5 b/MultiVideoApplication/features/home/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a40a436c346c4b3523266ab801e76f4d38bcec0 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "home", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/element/color.json b/MultiVideoApplication/features/home/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1eb948ae93981eca88ae45a2eea7f8e5f8a7d76d --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/element/color.json @@ -0,0 +1,56 @@ +{ + "color": [ + { + "name": "tab_sel_color", + "value": "#ED6F21" + }, + { + "name": "swiper_indicator", + "value": "#4DFFFFFF" + }, + { + "name": "main_daily_rating_background", + "value": "#4D000000" + }, + { + "name": "button_background", + "value": "#0D000000" + }, + { + "name": "previous_one_button_origin", + "value": "#ED6F21" + }, + { + "name": "home_component_background", + "value": "#F1F3F5" + }, + { + "name": "side_bar_background", + "value": "#0DFFFFFF" + }, + { + "name": "normal_font_color", + "value": "#182431" + }, + { + "name": "home_content_background", + "value": "#222A3E" + }, + { + "name": "home_content_background_md", + "value": "#273148" + }, + { + "name": "search_bar_background", + "value": "#66FFFFFF" + }, + { + "name": "search_bar_background_origin", + "value": "#030418" + }, + { + "name": "tab_background_color", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/element/float.json b/MultiVideoApplication/features/home/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f7cfb5c8a0746960b629f48a92ac83e84e8558b8 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/element/float.json @@ -0,0 +1,912 @@ +{ + "float": [ + { + "name": "icon_tab_width", + "value": "24vp" + }, + { + "name": "icon_tab_height", + "value": "24vp" + }, + { + "name": "tab_font_size", + "value": "10fp" + }, + { + "name": "tab_top_margin", + "value": "4vp" + }, + { + "name": "tab_height_lg", + "value": "100vp" + }, + { + "name": "banner_height_sm", + "value": "368vp" + }, + { + "name": "banner_height_md", + "value": "194vp" + }, + { + "name": "banner_height_lg", + "value": "242vp" + }, + { + "name": "banner_text_1_font_sm", + "value": "18fp" + }, + { + "name": "banner_text_1_font_md", + "value": "14fp" + }, + { + "name": "banner_text_1_font_lg", + "value": "24fp" + }, + { + "name": "banner_text_1_height_sm", + "value": "24vp" + }, + { + "name": "banner_text_1_height_md", + "value": "19vp" + }, + { + "name": "banner_text_1_height_lg", + "value": "32vp" + }, + { + "name": "banner_text_2_font_sm", + "value": "11fp" + }, + { + "name": "banner_text_2_font_md", + "value": "11fp" + }, + { + "name": "banner_text_2_font_lg", + "value": "17fp" + }, + { + "name": "banner_text_2_height_sm", + "value": "15vp" + }, + { + "name": "banner_text_2_height_md", + "value": "15vp" + }, + { + "name": "banner_text_2_height_lg", + "value": "23vp" + }, + { + "name": "home_content_padding_sm", + "value": "16vp" + }, + { + "name": "home_content_padding_md", + "value": "24vp" + }, + { + "name": "home_content_padding_lg", + "value": "36vp" + }, + { + "name": "home_recommended_padding_sm", + "value": "112vp" + }, + { + "name": "home_recommended_padding_md", + "value": "120vp" + }, + { + "name": "home_recommended_padding_lg", + "value": "132vp" + }, + { + "name": "home_content_padding", + "value": "24vp" + }, + { + "name": "banner_img_border_radius", + "value": "16vp" + }, + { + "name": "swiper_item_size", + "value": "6vp" + }, + { + "name": "swiper_prev_next_margin_lg", + "value": "64vp" + }, + { + "name": "swiper_prev_next_margin_md", + "value": "12vp" + }, + { + "name": "swiper_prev_next_margin_sm", + "value": "0vp" + }, + { + "name": "swiper_selected_item_width", + "value": "12vp" + }, + { + "name": "indicator_bottom", + "value": "12vp" + }, + { + "name": "new_banner_3_margin", + "value": "6vp" + }, + { + "name": "banner_margin", + "value": "12vp" + }, + { + "name": "banner_padding_sm", + "value": "16vp" + }, + { + "name": "icon_img_size", + "value": "40vp" + }, + { + "name": "icon_img_radius", + "value": "20vp" + }, + { + "name": "icon_img_bottom_margin", + "value": "4vp" + }, + { + "name": "icon_list_font_size", + "value": "12fp" + }, + { + "name": "icon_list_font_height", + "value": "20vp" + }, + { + "name": "icon_list_height", + "value": "76vp" + }, + { + "name": "icon_list_column_padding_lg", + "value": "24vp" + }, + { + "name": "icon_list_column_padding", + "value": "12vp" + }, + { + "name": "icon_list_column_margin_lg", + "value": "4vp" + }, + { + "name": "video_grid_gap", + "value": "12vp" + }, + { + "name": "new_video_height_sm", + "value": "120vp" + }, + { + "name": "new_video_height_md", + "value": "161vp" + }, + { + "name": "new_video_height_lg", + "value": "211vp" + }, + { + "name": "new_video_columns_gap", + "value": "12vp" + }, + { + "name": "grid_row_gutter", + "value": "12vp" + }, + { + "name": "main_daily_title_font_lg", + "value": "20fp" + }, + { + "name": "main_daily_title_font", + "value": "16fp" + }, + { + "name": "main_daily_margin_lg", + "value": "16vp" + }, + { + "name": "main_daily_margin", + "value": "12vp" + }, + { + "name": "search_top_height", + "value": "56vp" + }, + { + "name": "search_top_height_more", + "value": "92vp" + }, + { + "name": "search_top_padding_top", + "value": "36vp" + }, + { + "name": "search_top_padding", + "value": "24vp" + }, + { + "name": "search_tab_font_selected", + "value": "24fp" + }, + { + "name": "search_tab_font", + "value": "18fp" + }, + { + "name": "main_daily_rating_font_lg", + "value": "12fp" + }, + { + "name": "main_daily_rating_font", + "value": "8fp" + }, + { + "name": "main_daily_rating_height_lg", + "value": "18vp" + }, + { + "name": "main_daily_rating_height", + "value": "12vp" + }, + { + "name": "main_daily_rating_width_lg", + "value": "30vp" + }, + { + "name": "main_daily_rating_width", + "value": "20vp" + }, + { + "name": "main_daily_rating_right_lg", + "value": "16vp" + }, + { + "name": "main_daily_rating_right", + "value": "12vp" + }, + { + "name": "main_daily_rating_top_lg", + "value": "6vp" + }, + { + "name": "main_daily_rating_top", + "value": "5vp" + }, + { + "name": "main_daily_rating_radius_lg", + "value": "3vp" + }, + { + "name": "main_daily_rating_radius", + "value": "2vp" + }, + { + "name": "main_daily_row_height_lg", + "value": "46vp" + }, + { + "name": "main_daily_row_height", + "value": "33vp" + }, + { + "name": "small_daily_image_height_lg", + "value": "68vp" + }, + { + "name": "small_daily_image_height_md", + "value": "44vp" + }, + { + "name": "small_daily_image_height_sm", + "value": "40vp" + }, + { + "name": "small_daily_image_width_lg", + "value": "129vp" + }, + { + "name": "small_daily_image_width_md", + "value": "84vp" + }, + { + "name": "small_daily_image_width_sm", + "value": "76vp" + }, + { + "name": "main_daily_other_font_lg", + "value": "16fp" + }, + { + "name": "main_daily_other_font", + "value": "14fp" + }, + { + "name": "main_daily_content_font_lg", + "value": "14fp" + }, + { + "name": "main_daily_content_font", + "value": "12fp" + }, + { + "name": "small_daily_column_margin_lg", + "value": "16vp" + }, + { + "name": "small_daily_column_margin", + "value": "12vp" + }, + { + "name": "main_daily_button_font_lg", + "value": "14fp" + }, + { + "name": "main_daily_button_font", + "value": "12fp" + }, + { + "name": "main_daily_button_height_lg", + "value": "34vp" + }, + { + "name": "main_daily_button_width_lg", + "value": "77vp" + }, + { + "name": "main_daily_button_radius", + "value": "16vp" + }, + { + "name": "small_daily_row_padding_lg", + "value": "16vp" + }, + { + "name": "small_daily_row_padding", + "value": "12vp" + }, + { + "name": "card_radius", + "value": "36vp" + }, + { + "name": "daily_title_font_lg", + "value": "16fp" + }, + { + "name": "daily_title_font", + "value": "14fp" + }, + { + "name": "daily_title_margin", + "value": "4vp" + }, + { + "name": "daily_content_font", + "value": "12fp" + }, + { + "name": "daily_content_margin", + "value": "2vp" + }, + { + "name": "daily_grid_gap", + "value": "12vp" + }, + { + "name": "previous_one_image_margin_sm", + "value": "10vp" + }, + { + "name": "previous_one_image_margin", + "value": "12vp" + }, + { + "name": "previous_one_title_font_sm", + "value": "14fp" + }, + { + "name": "previous_one_title_font_md", + "value": "16fp" + }, + { + "name": "previous_one_title_font_lg", + "value": "18fp" + }, + { + "name": "previous_one_content_font_sm", + "value": "10fp" + }, + { + "name": "previous_one_content_font_md", + "value": "12fp" + }, + { + "name": "previous_one_content_font_lg", + "value": "14fp" + }, + { + "name": "previous_one_content_margin", + "value": "4vp" + }, + { + "name": "previous_one_button_radius", + "value": "12.5vp" + }, + { + "name": "previous_one_button_font_lg", + "value": "14fp" + }, + { + "name": "previous_one_button_font", + "value": "12fp" + }, + { + "name": "previous_one_button_height_lg", + "value": "34vp" + }, + { + "name": "previous_one_button_height", + "value": "25vp" + }, + { + "name": "previous_one_row_padding_sm", + "value": "10vp" + }, + { + "name": "previous_one_row_padding", + "value": "12vp" + }, + { + "name": "previous_two_title_font_lg", + "value": "20fp" + }, + { + "name": "previous_two_title_font", + "value": "14fp" + }, + { + "name": "previous_two_title_line_lg", + "value": "28vp" + }, + { + "name": "previous_two_title_line", + "value": "21vp" + }, + { + "name": "previous_two_content_font_lg", + "value": "16fp" + }, + { + "name": "previous_two_content_font", + "value": "12fp" + }, + { + "name": "previous_two_content_margin_lg", + "value": "6vp" + }, + { + "name": "previous_two_content_margin", + "value": "4vp" + }, + { + "name": "previous_two_content_line_lg", + "value": "20vp" + }, + { + "name": "previous_two_content_line", + "value": "18vp" + }, + { + "name": "previous_two_column_height_lg", + "value": "80vp" + }, + { + "name": "previous_two_column_height", + "value": "61vp" + }, + { + "name": "previous_two_column_padding_lg", + "value": "12vp" + }, + { + "name": "previous_two_column_padding", + "value": "8vp" + }, + { + "name": "previous_two_column_bottom_lg", + "value": "14vp" + }, + { + "name": "previous_two_column_bottom", + "value": "10vp" + }, + { + "name": "previous_two_radius", + "value": "18vp" + }, + { + "name": "sub_title_font", + "value": "16fp" + }, + { + "name": "sub_title_row_height", + "value": "22vp" + }, + { + "name": "sub_title_row_margin", + "value": "13vp" + }, + { + "name": "focus_more_size", + "value": "6vp" + }, + { + "name": "video_img_size_lg", + "value": "32vp" + }, + { + "name": "video_img_size", + "value": "24vp" + }, + { + "name": "video_img_rating_font", + "value": "7fp" + }, + { + "name": "video_img_rating_height", + "value": "12vp" + }, + { + "name": "video_img_rating_width", + "value": "20vp" + }, + { + "name": "video_img_rating_margin", + "value": "8vp" + }, + { + "name": "video_img_rating_radius", + "value": "2vp" + }, + { + "name": "video_content_font", + "value": "12fp" + }, + { + "name": "video_content_line", + "value": "18vp" + }, + { + "name": "video_content_margin", + "value": "2vp" + }, + { + "name": "video_title_font", + "value": "14fp" + }, + { + "name": "video_title_line", + "value": "21vp" + }, + { + "name": "video_title_line_lg", + "value": "24vp" + }, + { + "name": "video_title_margin", + "value": "4vp" + }, + { + "name": "top_tab_list_height_selected", + "value": "33vp" + }, + { + "name": "top_tab_list_height", + "value": "25vp" + }, + { + "name": "top_tab_list_top_selected", + "value": "12vp" + }, + { + "name": "top_tab_list_top", + "value": "18vp" + }, + { + "name": "top_tab_list_bottom_selected", + "value": "11vp" + }, + { + "name": "top_tab_list_bottom", + "value": "13vp" + }, + { + "name": "top_tab_img_size", + "value": "24vp" + }, + { + "name": "top_tab_img_margin", + "value": "24vp" + }, + { + "name": "tab_size", + "value": "76vp" + }, + { + "name": "top_bar_height", + "value": "56vp" + }, + { + "name": "bottom_navigation", + "value": "24vp" + }, + { + "name": "tab_size_lg", + "value": "56vp" + }, + { + "name": "search_input_font", + "value": "16fp" + }, + { + "name": "search_input_height", + "value": "40vp" + }, + { + "name": "search_input_left", + "value": "36vp" + }, + { + "name": "search_input_right", + "value": "12vp" + }, + { + "name": "search_img_size", + "value": "16vp" + }, + { + "name": "search_img_left", + "value": "12vp" + }, + { + "name": "history_img_size", + "value": "24vp" + }, + { + "name": "history_img_left", + "value": "24vp" + }, + { + "name": "bottom_tab_bar_width_lg", + "value": "96vp" + }, + { + "name": "x_component_radius", + "value": "24vp" + }, + { + "name": "dialog_col_margin", + "value": "12vp" + }, + { + "name": "dialog_col_height_sm", + "value": "161vp" + }, + { + "name": "dialog_col_height_md", + "value": "268vp" + }, + { + "name": "dialog_col_height_lg", + "value": "347vp" + }, + { + "name": "dialog_col_width_sm", + "value": "280vp" + }, + { + "name": "dialog_col_width_md", + "value": "466vp" + }, + { + "name": "dialog_col_width_lg", + "value": "604vp" + }, + { + "name": "dialog_text_col_width_lg", + "value": "186vp" + }, + { + "name": "dialog_text_col_width", + "value": "156vp" + }, + { + "name": "dialog_text_col_padding", + "value": "16vp" + }, + { + "name": "dialog_icon_size", + "value": "24vp" + }, + { + "name": "dialog_icon_margin", + "value": "8vp" + }, + { + "name": "dialog_text_font", + "value": "16fp" + }, + { + "name": "dialog_menu_row_height", + "value": "48vp" + }, + { + "name": "dialog_text_radius", + "value": "16vp" + }, + { + "name": "immersive_banner_height_sm", + "value": "334vp" + }, + { + "name": "immersive_banner_height_md", + "value": "370vp" + }, + { + "name": "immersive_banner_height_lg", + "value": "396vp" + }, + { + "name": "immersive_background_height_sm", + "value": "384vp" + }, + { + "name": "immersive_background_height_md", + "value": "420vp" + }, + { + "name": "immersive_background_height_lg", + "value": "720vp" + }, + { + "name": "side_bar_width", + "value": "96vp" + }, + { + "name": "top_navigation_height", + "value": "36vp" + }, + { + "name": "previous_blank_width_md", + "value": "20vp" + }, + { + "name": "previous_blank_width", + "value": "6vp" + }, + { + "name": "recommended_video_padding_top", + "value": "12vp" + }, + { + "name": "recommended_video_padding_bottom", + "value": "6vp" + }, + { + "name": "immersive_text_1_font_sm", + "value": "18fp" + }, + { + "name": "immersive_text_1_font_md", + "value": "28fp" + }, + { + "name": "immersive_text_1_font_lg", + "value": "40fp" + }, + { + "name": "immersive_text_1_line_sm", + "value": "20vp" + }, + { + "name": "immersive_text_1_line_md", + "value": "36vp" + }, + { + "name": "immersive_text_1_line_lg", + "value": "54vp" + }, + { + "name": "immersive_text_2_font_sm", + "value": "14fp" + }, + { + "name": "immersive_text_2_font_md", + "value": "21fp" + }, + { + "name": "immersive_text_2_font_lg", + "value": "28fp" + }, + { + "name": "immersive_text_2_line_sm", + "value": "19vp" + }, + { + "name": "immersive_text_2_line_md", + "value": "28vp" + }, + { + "name": "immersive_text_2_line_lg", + "value": "48vp" + }, + { + "name": "immersive_col_padding_left_sm", + "value": "0vp" + }, + { + "name": "immersive_col_padding_left_md", + "value": "82vp" + }, + { + "name": "immersive_col_padding_left_lg", + "value": "58vp" + }, + { + "name": "immersive_col_padding_top_sm", + "value": "139vp" + }, + { + "name": "immersive_col_padding_top_md", + "value": "90vp" + }, + { + "name": "immersive_col_padding_top_lg", + "value": "106vp" + }, + { + "name": "immersive_col_margin", + "value": "36vp" + }, + { + "name": "daily_small_img_radius", + "value": "8vp" + }, + { + "name": "text_focus_radius", + "value": "4vp" + }, + { + "name": "top_text_width_selected", + "value": "48vp" + }, + { + "name": "top_text_width", + "value": "36vp" + }, + { + "name": "banner_focus_radius", + "value": "16vp" + }, + { + "name": "daily_main_focus_radius", + "value": "18vp" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/element/string.json b/MultiVideoApplication/features/home/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f8ec58923ee80084ff9540cd56f612975f42ed5 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/element/string.json @@ -0,0 +1,180 @@ +{ + "string": [ + { + "name": "tab_home", + "value": "首页" + }, + { + "name": "tab_development", + "value": "动态" + }, + { + "name": "tab_member", + "value": "会员购" + }, + { + "name": "tab_mine", + "value": "我的" + }, + { + "name": "sift", + "value": "精选" + }, + { + "name": "video", + "value": "视频" + }, + { + "name": "community", + "value": "社区" + }, + { + "name": "news", + "value": "新闻" + }, + { + "name": "shop", + "value": "购物" + }, + { + "name": "science", + "value": "科技" + }, + { + "name": "finance", + "value": "财经" + }, + { + "name": "history", + "value": "历史" + }, + { + "name": "affairs", + "value": "军事" + }, + { + "name": "all", + "value": "全部" + }, + { + "name": "heat_list", + "value": "周热榜" + }, + { + "name": "free", + "value": "免费" + }, + { + "name": "sutra", + "value": "经典" + }, + { + "name": "prefecture", + "value": "专区" + }, + { + "name": "kids_only", + "value": "儿童专区" + }, + { + "name": "zone", + "value": "华为专区" + }, + { + "name": "Premium_products", + "value": "付费精品" + }, + { + "name": "Fitness", + "value": "健身专区" + }, + { + "name": "new", + "value": "新 品 发 布 会" + }, + { + "name": "folding", + "value": "折叠旗舰及全场景" + }, + { + "name": "cultural", + "value": "建筑人文史迹" + }, + { + "name": "europe", + "value": "欧洲建筑的历史责任在载对欧洲建筑风格的形成和" + }, + { + "name": "life", + "value": "华为全场景智慧生活" + }, + { + "name": "landscape", + "value": "数百万年前,地貌形成" + }, + { + "name": "explore", + "value": "生命之源:探索生命之源" + }, + { + "name": "source", + "value": "探索生命之源" + }, + { + "name": "lonely", + "value": "孤独者" + }, + { + "name": "film", + "value": "电影 · 剧情片 · 2008年上" + }, + { + "name": "plays", + "value": "75.2万次播放" + }, + { + "name": "release", + "value": "新片发布" + }, + { + "name": "tablet", + "value": "每日佳片" + }, + { + "name": "back", + "value": "往期回顾" + }, + { + "name": "follow", + "value": "关注" + }, + { + "name": "play_on", + "value": "继续播放" + }, + { + "name": "player", + "value": "播放" + }, + { + "name": "cache", + "value": "缓存" + }, + { + "name": "search", + "value": "搜索..." + }, + { + "name": "binge_watch", + "value": "追剧" + }, + { + "name": "Collect", + "value": "Collect" + }, + { + "name": "like", + "value": "点赞" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_small_video.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_small_video.png new file mode 100644 index 0000000000000000000000000000000000000000..3f43d3ccf7e831c2c215e751a15142653af2c45c Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_small_video.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video.png new file mode 100644 index 0000000000000000000000000000000000000000..50d1bc6164ec948f602520920684b00ea21e01c8 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_1.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..9761e16a96eaed9045b0efb9e724b8e9781c5b24 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_1.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_2.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..826fae5320eb9c568a98a944132caa80cb029c48 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_2.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_3.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..28df9e1c5a0f5e869d63937a9b13a64a5d1925d5 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_3.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_4.png b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..31eddee895f4afecdd7706ed18a39b37de75f3f5 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/daily_video_4.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1.png new file mode 100644 index 0000000000000000000000000000000000000000..d20e1160539be01de69117c20202705cad5a337c Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1_sm.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1_sm.png new file mode 100644 index 0000000000000000000000000000000000000000..cf5314b9a9de6a20f135d4387b0675986a04cf12 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_1_sm.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2.png new file mode 100644 index 0000000000000000000000000000000000000000..70f05756cc7b65fedf9492bcf4c860dc8a5262b4 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2_sm.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2_sm.png new file mode 100644 index 0000000000000000000000000000000000000000..8ed7d3da497b89ab62edc96e36c911d8a084e73b Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_2_sm.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4d25956554b51f097820a212bb2457b67ac2c99d Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3_sm.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3_sm.png new file mode 100644 index 0000000000000000000000000000000000000000..1ac535c88b8ffac76cdcb58da0a213e8d312bdb6 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_3_sm.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_4.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_4.png new file mode 100644 index 0000000000000000000000000000000000000000..1a54b3b93be48fff421a40f68275573bee910d9f Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_banner_4.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_left.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_left.svg new file mode 100644 index 0000000000000000000000000000000000000000..a8a9835a05b06db88c9b3efb0016e9da95dcd611 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_left.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_arrow_left_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..ee67988c6081fc307aff51d27919c677f76a1718 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_arrow_right_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_favor.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_favor.svg new file mode 100644 index 0000000000000000000000000000000000000000..6ed99945bb665979fb509f76d42aa8244eec279f --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_favor.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_highlights.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_highlights.svg new file mode 100644 index 0000000000000000000000000000000000000000..7f0c77423290d138e1c06b9de163af52d0ba0195 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_highlights.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_collect + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history.svg new file mode 100644 index 0000000000000000000000000000000000000000..2d83d68334c075451ab562ef5b3bba2b83fe5ed8 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_history + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history_white.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history_white.png new file mode 100644 index 0000000000000000000000000000000000000000..fa5ab65d43f7c8fea35c5744895a78751b2238a7 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_history_white.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f18da93f13e1826932c43bcd7af3a14ece59e74 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_more + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more_white.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..70703b404c71aea22b3989be7fd2ffc52da13519 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_more_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_more + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..423182ce01e353a362155bdb443b9686672631d9 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_search + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search_white.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..f9e58050aeb1995c126bfb2ae3215de123c9b517 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_search_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_search + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_view_list.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_view_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..b7958b5ed4ffae4828718857883cefec420b458d --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_public_view_list.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_view_list_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_normal.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_normal.svg new file mode 100644 index 0000000000000000000000000000000000000000..d379c81ad929d6f0a75d350e30317a9dcc94abee --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_normal.svg @@ -0,0 +1,12 @@ + + + 编组 21 + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_selected.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..d9895b7d534da8e5966c713b9f8f7bf4fc7803f8 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_selected.svg @@ -0,0 +1,23 @@ + + + 编组 20 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_white.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..9c8f6e1bce0b61e9599b43ce0de8fb1efeca0c84 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_home_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_home_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_normal.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_normal.svg new file mode 100644 index 0000000000000000000000000000000000000000..265dc646e493636c0b439b976d86336020f9751b --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_normal.svg @@ -0,0 +1,12 @@ + + + tab/ic_备份 71 + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_selected.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..46050054044d70c32a151f3072882eef690ed273 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_selected.svg @@ -0,0 +1,13 @@ + + + 编组 23 + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_white.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..ea562ca1f468505f31cbb07b941cda58ca9f13b1 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_mine_white.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_normal.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_normal.svg new file mode 100644 index 0000000000000000000000000000000000000000..55892be58a12d7ebcacf659b5f40e81a05648828 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_normal.svg @@ -0,0 +1,29 @@ + + + 图标 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_selected.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..bd3fe25c437feb0e0767259f8f5bc617101d3600 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_selected.svg @@ -0,0 +1,13 @@ + + + 编组 22 + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_white.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_white.png new file mode 100644 index 0000000000000000000000000000000000000000..ea7a12ab80c88496caef080ec3de08c152c027bc Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_post_white.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_normal.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_normal.svg new file mode 100644 index 0000000000000000000000000000000000000000..c8c9d45daa6983dc772219a7021bbe739048a6d4 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_normal.svg @@ -0,0 +1,14 @@ + + + 图标备份 2 + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_selected.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_selected.svg new file mode 100644 index 0000000000000000000000000000000000000000..6b7f2502a4791e98d8fe35fca3bcabb2889fd71a --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_selected.svg @@ -0,0 +1,14 @@ + + + 图标备份 + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_white.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_white.png new file mode 100644 index 0000000000000000000000000000000000000000..5e8e2340473a7bbafa27f8b96e259e0499ddc990 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_tabs_vip_white.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_1.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_1.png new file mode 100644 index 0000000000000000000000000000000000000000..fb1e30c7eb7cd2cd968c54d37d6bd502a9c35a20 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_1.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_10.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_10.png new file mode 100644 index 0000000000000000000000000000000000000000..6e323f8e74eded00e95c900b8d18cadf3b3990ef Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_10.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_2.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_2.png new file mode 100644 index 0000000000000000000000000000000000000000..d534c3f37fbfb306db5faf94c824e21f91f4aaf3 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_2.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_3.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_3.png new file mode 100644 index 0000000000000000000000000000000000000000..f6098c9879804b3999d7b364cf116b96c58d1ca5 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_3.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_4.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_4.png new file mode 100644 index 0000000000000000000000000000000000000000..aa1e01186135417d01c79da76590baf59fe8b795 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_4.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_5.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_5.png new file mode 100644 index 0000000000000000000000000000000000000000..613a6b9cefc65abdd13d1a9a85baa2d5ab43e639 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_5.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_6.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_6.png new file mode 100644 index 0000000000000000000000000000000000000000..e29590e5767ab2febf2323d87d66f7ebb51ed360 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_6.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_7.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_7.png new file mode 100644 index 0000000000000000000000000000000000000000..71f7efc76f533d510bd5397ffc43aa67bf5da034 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_7.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_8.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_8.png new file mode 100644 index 0000000000000000000000000000000000000000..b9470c073cbe7f49ad07ea0dbd1ba1b3665cc605 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_8.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_9.png b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_9.png new file mode 100644 index 0000000000000000000000000000000000000000..bb2f458f8f4ec54469f32419d1ec89ac8fb1080e Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/ic_video_grid_9.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_all.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..c6ec5b7dc2745551c5d747a7226556b285e3cf1d --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_all.svg @@ -0,0 +1,12 @@ + + + 全部橙 + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classes.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classes.svg new file mode 100644 index 0000000000000000000000000000000000000000..cabf5055df57003a7ee2136730c9e341be29085d --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classes.svg @@ -0,0 +1,17 @@ + + + 课程专区 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classic.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classic.svg new file mode 100644 index 0000000000000000000000000000000000000000..51e3cdc07a7816e80c206d8117299c70f1a20e83 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_classic.svg @@ -0,0 +1,12 @@ + + + 经典橙 + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_fitness.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_fitness.svg new file mode 100644 index 0000000000000000000000000000000000000000..ff380c8056a72d4e4d3267a75f746034b95d18b5 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_fitness.svg @@ -0,0 +1,13 @@ + + + 健身 + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_free.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_free.svg new file mode 100644 index 0000000000000000000000000000000000000000..cdda62c89fc8a834505c1cf1897b49ee9d7b949e --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_free.svg @@ -0,0 +1,21 @@ + + + 免费橙 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_kid.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_kid.svg new file mode 100644 index 0000000000000000000000000000000000000000..790a53146fe8569ba303d12fbcd258d022e0cbca --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_kid.svg @@ -0,0 +1,15 @@ + + + 儿童专区 + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_live.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_live.svg new file mode 100644 index 0000000000000000000000000000000000000000..a8d8452d5bf8606bdab27b0b239c8e5ba9641b04 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_live.svg @@ -0,0 +1,15 @@ + + + 直播 + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_vip.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_vip.svg new file mode 100644 index 0000000000000000000000000000000000000000..2086f6e5642e219c7c004bf41b2a65c3f4c84b7c --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_vip.svg @@ -0,0 +1,13 @@ + + + 会员专区橙 + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/icon_weekly_hot.svg b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_weekly_hot.svg new file mode 100644 index 0000000000000000000000000000000000000000..7bcc290e310d0ec811cc71d7cb94bfedc3eeab4b --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/base/media/icon_weekly_hot.svg @@ -0,0 +1,15 @@ + + + 周热榜橙 + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_lg.png b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_lg.png new file mode 100644 index 0000000000000000000000000000000000000000..b2b5ef53b9afbe9be86c33427f9d8028a9ac9f15 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_lg.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_md.png b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_md.png new file mode 100644 index 0000000000000000000000000000000000000000..e32bdd8b44cdbc8fb7738516d88c70b86d79669d Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_md.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_sm.png b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_sm.png new file mode 100644 index 0000000000000000000000000000000000000000..1673f55bcc69686bdf99af642d3f4fa3b693f2ff Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/immersive_background_sm.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_1.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..35d47d00d4b5b30d3686fef0f48493cdaa13fa03 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_1.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_2.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..c0323f4793ddf9e18ee1f0e7e8ea08545944050a Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_2.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_3.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4180b2054911ec6e0bf98b7757ab6ae93693e522 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_3.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_4.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..2a484b6b412c947baa99c4f1adc9c4f7b6999c23 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_4.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_5.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_5.png new file mode 100644 index 0000000000000000000000000000000000000000..e5b18ddab1e2fa089400f0e6174a7a107601f731 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_5.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_6.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_6.png new file mode 100644 index 0000000000000000000000000000000000000000..f234ea2f4ff9cf22d6fb5e50fd3e4e958ea93f58 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_6.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_7.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_7.png new file mode 100644 index 0000000000000000000000000000000000000000..d27057837163e75917e27d02cf2c0b8f82169d1b Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_7.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_play.png b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_play.png new file mode 100644 index 0000000000000000000000000000000000000000..ecf58bb0989563dde1f95cc6e3c39eafee25b14d Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/new_video_play.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_1.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..8a4213f8e48ea159ea55569a5180faa9ee2dcd20 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_1.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_2.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e758888ac09052eed6e214bab7e682323c4fd65b Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_2.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_3.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..91da2c136287d68f5c0d9171023c90ac6fffe5e9 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_3.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_4.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..51cbd35ce8668de05d9236b2a3dbde06fa6f6bc8 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_4.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_5.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_5.png new file mode 100644 index 0000000000000000000000000000000000000000..bf40722e4d020615db348d113b955928050c6dfb Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_5.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_6.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_6.png new file mode 100644 index 0000000000000000000000000000000000000000..f720ba4448b6b9f0993d4518cf295f089ce2cf59 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_6.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_7.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_7.png new file mode 100644 index 0000000000000000000000000000000000000000..e9b92def1abb235e2a9ed4dd3123652db49d232e Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_7.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_8.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_8.png new file mode 100644 index 0000000000000000000000000000000000000000..05d5ea74d4d91009ccea8b6e4ca7d776653e9585 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_8.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_9.png b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_9.png new file mode 100644 index 0000000000000000000000000000000000000000..4b2270ff4b7700d22cc21a36d3a29c5cf4a071e2 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/previous_video_9.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/base/media/white_background.png b/MultiVideoApplication/features/home/src/main/resources/base/media/white_background.png new file mode 100644 index 0000000000000000000000000000000000000000..0425fe44248edc72dcdb5b18bb7528d5f86ddd56 Binary files /dev/null and b/MultiVideoApplication/features/home/src/main/resources/base/media/white_background.png differ diff --git a/MultiVideoApplication/features/home/src/main/resources/en_US/element/string.json b/MultiVideoApplication/features/home/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7b83743c4aa55169a262e045850cb0e0579a2ec9 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/en_US/element/string.json @@ -0,0 +1,180 @@ +{ + "string": [ + { + "name": "tab_home", + "value": "home" + }, + { + "name": "tab_development", + "value": "develop" + }, + { + "name": "tab_member", + "value": "member" + }, + { + "name": "tab_mine", + "value": "my" + }, + { + "name": "sift", + "value": "Sift" + }, + { + "name": "video", + "value": "Video" + }, + { + "name": "community", + "value": "Area" + }, + { + "name": "news", + "value": "News" + }, + { + "name": "shop", + "value": "Shop" + }, + { + "name": "science", + "value": "Science" + }, + { + "name": "finance", + "value": "Finance" + }, + { + "name": "history", + "value": "History" + }, + { + "name": "affairs", + "value": "Affairs" + }, + { + "name": "all", + "value": "all" + }, + { + "name": "heat_list", + "value": "heat list" + }, + { + "name": "free", + "value": "free" + }, + { + "name": "sutra", + "value": "sutra" + }, + { + "name": "prefecture", + "value": "prefecture" + }, + { + "name": "kids_only", + "value": "kids only" + }, + { + "name": "zone", + "value": "HUAWEI zone" + }, + { + "name": "Premium_products", + "value": "pay products" + }, + { + "name": "Fitness", + "value": "fitness area" + }, + { + "name": "new", + "value": "New product distribution meeting" + }, + { + "name": "folding", + "value": "Folding flagship and full scene" + }, + { + "name": "cultural", + "value": "Architectural cultural and historical sites" + }, + { + "name": "europe", + "value": "The historical responsibility of European architecture lies in the formation and development of European architectural styles" + }, + { + "name": "life", + "value": "Huawei full scene smart life" + }, + { + "name": "landscape", + "value": "Millions of years ago, the landscape was formed" + }, + { + "name": "explore", + "value": "The source of life: to explore the source of life" + }, + { + "name": "source", + "value": "To explore the source of life" + }, + { + "name": "lonely", + "value": "lonely" + }, + { + "name": "film", + "value": "Film · Feature Film · 2008" + }, + { + "name": "plays", + "value": "752,000 plays" + }, + { + "name": "release", + "value": "New film release" + }, + { + "name": "tablet", + "value": "Daily best tablet" + }, + { + "name": "back", + "value": "Look back" + }, + { + "name": "follow", + "value": "follow" + }, + { + "name": "play_on", + "value": "Play on" + }, + { + "name": "player", + "value": "play" + }, + { + "name": "cache", + "value": "cache" + }, + { + "name": "search", + "value": "Search..." + }, + { + "name": "binge_watch", + "value": "Watch" + }, + { + "name": "Collect", + "value": "Collect" + }, + { + "name": "like", + "value": "Like" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/home/src/main/resources/zh_CN/element/string.json b/MultiVideoApplication/features/home/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..331169b0e5528adbc0c9f26818fd61488dccd917 --- /dev/null +++ b/MultiVideoApplication/features/home/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,179 @@ +{ + "string": [ + { + "name": "tab_home", + "value": "首页" + }, + { + "name": "tab_development", + "value": "动态" + }, + { + "name": "tab_member", + "value": "会员购" + }, + { + "name": "tab_mine", + "value": "我的" + }, + { + "name": "sift", + "value": "精选" + }, + { + "name": "video", + "value": "视频" + }, + { + "name": "community", + "value": "社区" + }, + { + "name": "news", + "value": "新闻" + }, + { + "name": "shop", + "value": "购物" + }, + { + "name": "science", + "value": "科技" + }, + { + "name": "finance", + "value": "财经" + }, + { + "name": "history", + "value": "历史" + }, + { + "name": "affairs", + "value": "军事" + }, + { + "name": "all", + "value": "全部" + }, + { + "name": "heat_list", + "value": "周热榜" + }, + { + "name": "free", + "value": "免费" + }, + { + "name": "sutra", + "value": "经典" + }, + { + "name": "prefecture", + "value": "专区" + }, + { + "name": "kids_only", + "value": "儿童专区" + }, + { + "name": "zone", + "value": "华为专区" + }, + { + "name": "Premium_products", + "value": "付费精品" + }, + { + "name": "Fitness", + "value": "健身专区" + }, + { + "name": "new", + "value": "新 品 发 布 会" + }, + { + "name": "folding", + "value": "折叠旗舰及全场景" + }, + { + "name": "cultural", + "value": "建筑人文史迹" + }, + { + "name": "europe", + "value": "欧洲建筑的历史责任在载对欧洲建筑风格的形成和" + }, + { + "name": "life", + "value": "华为全场景智慧生活" + }, + { + "name": "landscape", + "value": "数百万年前,地貌形成" + }, + { + "name": "explore", + "value": "生命之源:探索生命之源" + }, + { + "name": "source", + "value": "探索生命之源" + }, + { + "name": "lonely", + "value": "孤独者" + }, + { + "name": "film", + "value": "电影 · 剧情片 · 2008年上" + },{ + "name": "plays", + "value": "75.2万次播放" + }, + { + "name": "release", + "value": "新片发布" + }, + { + "name": "tablet", + "value": "每日佳片" + }, + { + "name": "back", + "value": "往期回顾" + }, + { + "name": "follow", + "value": "关注" + }, + { + "name": "play_on", + "value": "继续播放" + }, + { + "name": "player", + "value": "播放" + }, + { + "name": "cache", + "value": "缓存" + }, + { + "name": "search", + "value": "搜索..." + }, + { + "name": "binge_watch", + "value": "追剧" + }, + { + "name": "Collect", + "value": "收藏" + }, + { + "name": "like", + "value": "点赞" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/Index.ets b/MultiVideoApplication/features/search/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b7653c737b23055fc11ef760c80410c588fdaf8 --- /dev/null +++ b/MultiVideoApplication/features/search/Index.ets @@ -0,0 +1 @@ +export { SearchView } from './src/main/ets/view/SearchView'; \ No newline at end of file diff --git a/MultiVideoApplication/features/search/build-profile.json5 b/MultiVideoApplication/features/search/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3167e54d1ff3a0aaa0cdcf4319789de8e3f3c350 --- /dev/null +++ b/MultiVideoApplication/features/search/build-profile.json5 @@ -0,0 +1,10 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/hvigorfile.ts b/MultiVideoApplication/features/search/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiVideoApplication/features/search/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiVideoApplication/features/search/oh-package.json5 b/MultiVideoApplication/features/search/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1e59e4e9d63e26e2df5d2d8fd50f876404b17200 --- /dev/null +++ b/MultiVideoApplication/features/search/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "search", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/constants/SearchConstants.ets b/MultiVideoApplication/features/search/src/main/ets/constants/SearchConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..61f952e807c16eeebc85286d3cd55c711cbe810b --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/constants/SearchConstants.ets @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2023 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 class SearchConstants { + /** + * Searching for a recommendation list in large devices. + */ + static readonly SEARCH_DISCOVERY_LARGE: ResourceStr[] = + [$r('app.string.search'), $r('app.string.search'), $r('app.string.search'), $r('app.string.search'), + $r('app.string.search'), + $r('app.string.search'), $r('app.string.search'), $r('app.string.search'), $r('app.string.search')]; + /** + * Tabs list. + */ + static readonly SEARCH_TABS: ResourceStr[] = + [$r('app.string.top'), $r('app.string.theater'), $r('app.string.movie'), $r('app.string.variety'), + $r('app.string.anime'), $r('app.string.children'), $r('app.string.records')]; + /** + * Search List for hua. + */ + static readonly HUA_LIST: ResourceStr[] = + [ $r('app.string.tv'), $r('app.string.tv'), $r('app.string.tv'), $r('app.string.conference'), + $r('app.string.tv'), $r('app.string.tv')]; + /** + * Search result tab List. + */ + static readonly SEARCH_RESULT_TAB_LIST: ResourceStr[] = [$r('app.string.all'), $r('app.string.filmer'), $r('app.string.video'), $r('app.string.user')]; + /** + * Search video img title list. + */ + static readonly SEARCH_IMG_IMG_TITLES: ResourceStr[] = + [$r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), + $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), + $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural'), $r('app.string.cultural')]; + /** + * Search video img content list. + */ + static readonly SEARCH_IMG_IMG_CONTENTS: ResourceStr[] = + [$r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe'), + $r('app.string.europe'), $r('app.string.europe'), $r('app.string.europe'), + $r('app.string.europe')]; + /** + * Search result title list. + */ + static readonly SEARCH_RESULT_TITLES: ResourceStr[] = [$r('app.string.flagship'), $r('app.string.flagship'), + $r('app.string.flagship')]; + /** + * Search result content list. + */ + static readonly SEARCH_RESULT_CONTENTS: ResourceStr[] = [$r('app.string.press'), $r('app.string.press'), + $r('app.string.press')]; + /** + * Search result more info list. + */ + static readonly SEARCH_RESULT_MORE: ResourceStr[] = [$r('app.string.plays'), $r('app.string.plays'), $r('app.string.plays')]; + /** + * Search sub title list. + */ + static readonly SEARCH_SUB_TITLES: ResourceStr[] = [$r('app.string.history_search'), $r('app.string.content'), $r('app.string.find')]; + /** + * Search recommend list lanes. + */ + static readonly SEARCH_LIST_LANES: number[] = [3, 2, 1]; + /** + * Hot trending list spaces. + */ + static readonly HOT_TRENDING_LIST_SPACES: string[] = ['16vp', '24vp', '36vp']; + /** + * Search recommend divider padding. + */ + static readonly SEARCH_RECOMMEND_DIVIDER_PADDING: string = '16vp'; + /** + * Search index. + */ + static readonly SEARCH_INDEX: number[] = [2, 3]; + /** + * Search placeholder. + */ + static readonly SEARCH_PLACEHOLDER: ResourceStr = $r('app.string.search1'); + /** + * Type tabs divider stroke width. + */ + static readonly TYPE_TABS_DIVIDER_STROKE_WIDTH: string = '2vp'; + /** + * Search result title. + */ + static readonly SEARCH_RESULT_TITLE: ResourceStr = $r('app.string.conference'); + /** + * Search result button text list. + */ + static readonly SEARCH_RESULT_BUTTON_TEXTS: ResourceStr[] = [$r('app.string.player'), $r('app.string.cache')]; + /** + * Video detail url. + */ + static readonly VIDEO_DETAIL_URL: string = '@bundle:com.huawei.videoapplication/videoDetail/ets/pages/Index'; + /** + * Search input list. + */ + static readonly SEARCH_INPUT_LIST: ResourceStr[] = ['华', '华为发布会']; + /** + * Hot video divider stroke width. + */ + static readonly DIVIDER_STROKE_WIDTH: string = '0.5vp'; +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/view/SearchContent.ets b/MultiVideoApplication/features/search/src/main/ets/view/SearchContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..6644d224d4390cbc3e08ecc427225e9824bb0418 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/view/SearchContent.ets @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; +import { SearchVideoImg } from '../viewmodel/SearchVideoImgViewModel'; + +@Component +export struct SearchContent { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State currentIndex: number = 0; + @Link searchVideoList: SearchVideoImg[]; + + build() { + Scroll() { + Column() { + this.searchHistory() + this.searchDiscovery() + this.searchHotTrending() + } + .alignItems(HorizontalAlign.Start) + .width(CommonConstants.FULL_PERCENT) + } + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.Off) + } + + @Builder + searchHistory() { + Row() { + Text(SearchConstants.SEARCH_SUB_TITLES[0]) + .fontSize($r('app.float.search_history_title_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + Image($r('app.media.ic_public_delete')) + .height($r('app.float.search_history_img_size')) + .width($r('app.float.search_history_img_size')) + .opacity(CommonConstants.TEXT_OPACITY[4]) + } + .margin({ top: $r('app.float.search_history_title_margin') }) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.search_history_title_height')) + + Row() { + this.searchContent() + this.searchContent() + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.search_history_content_height')) + .margin({ top: $r('app.float.search_history_content_margin') }) + } + + @Builder + searchContent() { + Row() { + Text(SearchConstants.SEARCH_SUB_TITLES[1]) + .fontSize($r('app.float.search_history_content_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .justifyContent(FlexAlign.Center) + .width($r('app.float.search_history_content_row_width')) + .height($r('app.float.search_history_content_row_height')) + .borderRadius($r('app.float.search_history_content_row_radius')) + .backgroundColor($r('app.color.result_background')) + .margin({ right: new BreakpointType($r('app.float.search_content_margin_right_sm'), + $r('app.float.search_content_margin_right_md'), $r('app.float.search_content_margin_right_lg')) + .getValue(this.currentWidthBreakpoint) }) + } + // [Start search_content_discovery] + @Builder + searchDiscovery() { + Row() { + Text(SearchConstants.SEARCH_SUB_TITLES[2]) + .fontSize($r('app.float.search_history_title_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Blank() + Image($r('app.media.ic_public_rotate')) + .height($r('app.float.search_discovery_img_size')) + .width($r('app.float.search_discovery_img_size')) + .margin({ right: $r('app.float.search_discovery_img_margin') }) + .fillColor($r('app.color.type_tabs_font_selected')) + } + .height($r('app.float.search_discovery_row_height')) + .width(CommonConstants.FULL_PERCENT) + .margin({ top: $r('app.float.search_discovery_img_margin') }) + + List() { + ForEach(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_DISCOVERY_LARGE : + SearchConstants.SEARCH_DISCOVERY_LARGE.slice(0, 6), (item: string, index: number) => { + ListItem() { + // [StartExclude search_content_discovery] + Column() { + Text(item) + .fontSize($r('app.float.search_discovery_list_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .padding({ right: this.getDividerPadding(this.currentWidthBreakpoint, index) }) + .height($r('app.float.search_discovery_list_column_height')) + .width(CommonConstants.FULL_PERCENT) + .margin({ top: $r('app.float.search_discovery_list_column_margin') }) + .alignItems(HorizontalAlign.Start) + // [EndExclude search_content_discovery] + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .width(CommonConstants.FULL_PERCENT) + .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_LIST_LANES[0] : + SearchConstants.SEARCH_LIST_LANES[1]) + } + // [End search_content_discovery] + + @Builder + searchHotTrending() { + List({ space: new BreakpointType(SearchConstants.HOT_TRENDING_LIST_SPACES[0], + SearchConstants.HOT_TRENDING_LIST_SPACES[1], SearchConstants.HOT_TRENDING_LIST_SPACES[2]) + .getValue(this.currentWidthBreakpoint) }) { + ForEach(SearchConstants.SEARCH_TABS, (item: string, index: number) => { + ListItem() { + Column() { + Text(item) + .fontSize($r('app.float.hot_trending_font')) + .lineHeight($r('app.float.hot_trending_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(index === this.currentIndex ? $r('app.color.type_tabs_font_selected') : Color.Black) + .opacity(index !== this.currentIndex ? CommonConstants.TEXT_OPACITY[2] : CommonConstants.TEXT_OPACITY[3]) + .margin({ top: $r('app.float.tabs_font_margin') }) + + Divider() + .strokeWidth(SearchConstants.TYPE_TABS_DIVIDER_STROKE_WIDTH) + .width($r('app.float.tab_divider_width')) + .color($r('app.color.type_tabs_font_selected')) + .visibility(index === this.currentIndex ? Visibility.Visible : Visibility.None) + .margin({ top: $r('app.float.tabs_divider_margin') }) + .lineCap(LineCapStyle.Round) + } + .height($r('app.float.hot_trending_tab_height')) + .justifyContent(FlexAlign.Start) + } + .onClick(() => { + this.currentIndex = index; + }) + }) + } + .margin({ top: $r('app.float.tab_list_margin') }) + .listDirection(Axis.Horizontal) + .scrollBar(BarState.Off) + + List() { + ForEach(this.searchVideoList, (item: SearchVideoImg, index: number) => { + ListItem() { + Row() { + Image(item.getImgSrc()) + .height($r('app.float.hot_video_img_size')) + .width($r('app.float.hot_video_img_size')) + .margin({ right: $r('app.float.hot_video_img_margin') }) + + Column() { + Text(item.getTitle()) + .fontSize($r('app.float.hot_video_title_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .lineHeight($r('app.float.hot_video_title_line')) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ top: $r('app.float.hot_video_title_margin') }) + Text(item.getContent()) + .fontSize($r('app.float.hot_video_content_font')) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.hot_video_content_line')) + .opacity(CommonConstants.TEXT_OPACITY[0]) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ top: $r('app.float.hot_video_content_margin') }) + Divider() + .strokeWidth(SearchConstants.DIVIDER_STROKE_WIDTH) + .width(CommonConstants.FULL_PERCENT) + .opacity(CommonConstants.DIVIDER_OPACITY) + } + .layoutWeight(1) + .alignItems(HorizontalAlign.Start) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } + .height($r('app.float.hot_video_row_height')) + }, (item: SearchVideoImg, index: number) => index + JSON.stringify(item)) + } + .width(CommonConstants.FULL_PERCENT) + .height(this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? $r('app.float.hot_video_list_height_sm') : + $r('app.float.hot_video_list_height')) + .lanes(new BreakpointType(SearchConstants.SEARCH_LIST_LANES[2], SearchConstants.SEARCH_LIST_LANES[1], + SearchConstants.SEARCH_LIST_LANES[0]).getValue(this.currentWidthBreakpoint), $r('app.float.hot_video_list_lane_space')) + .padding({ + top: $r('app.float.hot_video_list_padding'), + bottom: $r('app.float.hot_video_list_padding') + }) + .scrollBar(BarState.Off) + .edgeEffect(EdgeEffect.None) + } + + getDividerPadding(breakpoint: string, index: number): string { + if (breakpoint === BreakpointConstants.BREAKPOINT_LG) { + if (index % SearchConstants.SEARCH_LIST_LANES[0] !== 2) { + return SearchConstants.SEARCH_RECOMMEND_DIVIDER_PADDING; + } + } else { + if (index % SearchConstants.SEARCH_LIST_LANES[1] === 0) { + return SearchConstants.SEARCH_RECOMMEND_DIVIDER_PADDING; + } + } + return '0'; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/view/SearchForHua.ets b/MultiVideoApplication/features/search/src/main/ets/view/SearchForHua.ets new file mode 100644 index 0000000000000000000000000000000000000000..42c20b9a230c29d09dda49f6f4b73d3578469d79 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/view/SearchForHua.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { Logger } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; + +@Component +export struct SearchForHua { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Link searchInput: string; + + build() { + Column() { + // [Start searchForHua] + List() { + // [StartExclude searchForHua] + ForEach(SearchConstants.HUA_LIST, (item: string, index: number) => { + ListItem() { + Column() { + Text(item) + .fontSize($r('app.float.search_hua_list_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .height($r('app.float.search_hua_list_text_height')) + + Divider() + .color(Color.Black) + .height($r('app.float.search_hua_divider_height')) + .opacity(CommonConstants.DIVIDER_OPACITY) + .width(CommonConstants.FULL_PERCENT) + } + .alignItems(HorizontalAlign.Start) + .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && index % + SearchConstants.SEARCH_INDEX[0] === 0 ? $r('app.float.search_hua_column_margin_lg') : 0 }) + .height($r('app.float.search_hua_column_height')) + .onClick(() => { + if (index === SearchConstants.SEARCH_INDEX[1]) { + this.searchInput = item; + } else { + Logger.info(`Please click on the third list item`); + } + }) + } + }) + // [EndExclude searchForHua] + } + .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_LIST_LANES[1] : + SearchConstants.SEARCH_LIST_LANES[2]) + // [End searchForHua] + } + .layoutWeight(1) + .padding({ top: $r('app.float.search_hua_list_padding') }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/view/SearchHeader.ets b/MultiVideoApplication/features/search/src/main/ets/view/SearchHeader.ets new file mode 100644 index 0000000000000000000000000000000000000000..2816c88d8885bfbc94cb1df183d71010ae8d76ec --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/view/SearchHeader.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { CommonConstants } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; + +@Component +export struct SearchHeader { + @Link isSearching: boolean; + @Link searchInput: string; + @Link currentTopIndex: number; + + build() { + Row() { + Image($r('app.media.ic_public_back')) + .height($r('app.float.search_header_back_img_size')) + .width($r('app.float.search_header_back_img_size')) + .margin({ right: $r('app.float.search_header_back_img_margin') }) + .onClick(() => { + this.isSearching = false; + this.searchInput = ''; + }) + + Stack({ alignContent: Alignment.Start }) { + // Search box. + TextInput({ placeholder: SearchConstants.SEARCH_PLACEHOLDER, text: this.searchInput }) + .placeholderFont({ + size: $r('app.float.search_header_text_font'), + weight: FontWeight.Normal + }) + .height($r('app.float.search_header_text_height')) + .fontSize($r('app.float.search_header_text_font')) + .padding({ + left: $r('app.float.search_header_text_left'), + right: $r('app.float.search_header_text_right') + }) + .width(CommonConstants.FULL_PERCENT) + .enableKeyboardOnFocus(false) + .onChange((value: string) => { + this.searchInput = value; + }) + + // Search image. + Image($r("app.media.ic_public_search")) + .width($r('app.float.search_header_search_img_size')) + .height($r('app.float.search_header_search_img_size')) + .margin({ left: $r('app.float.search_header_search_img_margin') }) + } + .alignSelf(ItemAlign.Center) + .layoutWeight(1) + } + .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : + $r('app.float.search_header_row_padding') }) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.search_header_row_height') : + $r('app.float.search_header_row_height_more')) + .width(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/view/SearchResult.ets b/MultiVideoApplication/features/search/src/main/ets/view/SearchResult.ets new file mode 100644 index 0000000000000000000000000000000000000000..89dd5005d9cee2044fe63e19928ddfa2549eca17 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/view/SearchResult.ets @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants, VideoNavPathStack } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; +import { SearchVideoImg, SearchVideoImgModel } from '../viewmodel/SearchVideoImgViewModel'; + +@Component +export struct SearchResult { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @State resultTabIndex: number = 0; + @Consume('pageInfo') pageInfo: VideoNavPathStack; + + build() { + Scroll() { + Column() { + this.typeTabs() + this.resultVideos() + } + .alignItems(HorizontalAlign.Start) + } + .scrollBar(BarState.Off) + } + + @Builder + typeTabs() { + Row() { + List() { + ForEach(SearchConstants.SEARCH_RESULT_TAB_LIST, (item: string, index: number) => { + ListItem() { + Column() { + Text(item) + .fontSize($r('app.float.type_tabs_font')) + .fontWeight(index === this.resultTabIndex ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + .fontColor(index === this.resultTabIndex ? $r('app.color.type_tabs_font_selected') : + $r('app.color.type_tabs_font')) + .lineHeight($r('app.float.type_tabs_text_line')) + .margin({ top: $r('app.float.type_tabs_text_margin') }) + + Divider() + .strokeWidth(SearchConstants.TYPE_TABS_DIVIDER_STROKE_WIDTH) + .width(item.length === SearchConstants.SEARCH_INDEX[0] ? $r('app.float.type_tabs_divider_width_two') : + $r('app.float.type_tabs_divider_width_three')) + .color($r('app.color.type_tabs_font_selected')) + .margin({ top: $r('app.float.type_tabs_divider_margin') }) + .lineCap(LineCapStyle.Round) + .visibility(index === this.resultTabIndex ? Visibility.Visible : Visibility.None) + } + .width($r('app.float.type_tabs_col_width')) + .height(CommonConstants.FULL_PERCENT) + .margin({ right: index !== SearchConstants.SEARCH_RESULT_TAB_LIST.length - 1 ? + $r('app.float.type_tabs_col_margin'): 0 }) + .onClick(() => { + this.resultTabIndex = index; + }) + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + + Blank() + + Image($r('app.media.ic_public_sift')) + .height($r('app.float.sift_img_size')) + .width($r('app.float.sift_img_size')) + .opacity(CommonConstants.TEXT_OPACITY[4]) + } + .alignItems(VerticalAlign.Center) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.type_tabs_row_height')) + .margin({ top: $r('app.float.type_tabs_row_margin') }) + } + + @Builder + resultVideos() { + Row() { + Text(SearchConstants.SEARCH_RESULT_TITLE) + .fontSize($r('app.float.search_result_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .height($r('app.float.search_result_row_height')) + .margin({ + top: $r('app.float.search_result_row_margin'), + bottom: $r('app.float.search_result_row_margin') + }) + + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[1] + }, + gutter: $r('app.float.grid_row_gutter') + }){ + ForEach(new SearchVideoImgModel().getSearchResultImgList(), (item: SearchVideoImg, index: number) => { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[1], + lg: BreakpointConstants.GRID_COLUMN_SPANS[3] + } + }) { + Row() { + Image(item.getImgSrc()) + .objectFit(ImageFit.Fill) + .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') }) + .layoutWeight(CommonConstants.THREE) + .height(CommonConstants.FULL_PERCENT) + + Column() { + Text(item.getTitle()) + .fontSize(new BreakpointType($r('app.float.search_result_title_font_sm'), + $r('app.float.search_result_title_font_md'), $r('app.float.search_result_title_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Text(item.getContent()) + .fontSize(new BreakpointType($r('app.float.search_result_content_font_sm'), + $r('app.float.search_result_content_font_md'), $r('app.float.search_result_content_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.result_card_content_line_lg') : $r('app.float.result_card_content_line')) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .fontWeight(FontWeight.Normal) + .margin({ top: $r('app.float.search_result_content_margin') }) + .maxLines(1) + Text(item.getOtherInfo()) + .fontSize(new BreakpointType($r('app.float.search_result_content_font_sm'), + $r('app.float.search_result_content_font_md'), $r('app.float.search_result_content_font_lg')) + .getValue(this.currentWidthBreakpoint)) + .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.result_card_content_line_lg') : $r('app.float.result_card_content_line')) + .opacity(CommonConstants.TEXT_OPACITY[1]) + .fontWeight(FontWeight.Normal) + .margin({ top: $r('app.float.search_result_more_margin') }) + .maxLines(1) + + Row() { + Button(SearchConstants.SEARCH_RESULT_BUTTON_TEXTS[0]) + .backgroundColor($r('app.color.button_background_1')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .borderRadius($r('app.float.search_result_button_radius')) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) + .fontColor(Color.White) + .layoutWeight(1) + .onClick(() => { + this.pageInfo.setPageName(CommonConstants.PAGE_NAMES[1]); + this.pageInfo.pushPath({ name: CommonConstants.PAGE_NAMES[1] }); + }) + + Blank() + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD ? + $r('app.float.search_result_button_blank_md') : $r('app.float.search_result_button_blank')) + + Button(SearchConstants.SEARCH_RESULT_BUTTON_TEXTS[1]) + .backgroundColor($r('app.color.button_background_2')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .borderRadius($r('app.float.search_result_button_radius')) + .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) + .fontColor($r('app.color.button_background_1')) + .layoutWeight(1) + } + .width(CommonConstants.FULL_PERCENT) + .alignItems(VerticalAlign.Bottom) + .layoutWeight(1) + } + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + .layoutWeight(3) + } + .aspectRatio(CommonConstants.PREVIOUS_ONE_ROW_RATIO) + .height(new BreakpointType($r('app.float.result_list_row_height_sm'), + $r('app.float.result_list_row_height_md'), $r('app.float.result_list_row_height_lg')) + .getValue(this.currentWidthBreakpoint)) + .width(CommonConstants.FULL_PERCENT) + .padding({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding') + }) + .backgroundColor($r('app.color.result_background')) + .borderRadius($r('app.float.result_list_row_radius')) + } + }, (item: SearchVideoImg, index: number) => index + JSON.stringify(item)) + } + .margin({ bottom: $r('app.float.result_grid_row_margin') }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/ets/view/SearchView.ets b/MultiVideoApplication/features/search/src/main/ets/view/SearchView.ets new file mode 100644 index 0000000000000000000000000000000000000000..2eb2de735f727cbfe4752eef127f00a80fea8c6b --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/view/SearchView.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, BreakpointType, CommonConstants } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; +import { SearchVideoImg, SearchVideoImgModel } from '../viewmodel/SearchVideoImgViewModel'; +import { SearchContent } from './SearchContent'; +import { SearchForHua } from './SearchForHua'; +import { SearchHeader } from './SearchHeader'; +import { SearchResult } from './SearchResult'; + +@Component +export struct SearchView { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTopIndex') currentTopIndex: number = 0; + @State currentIndex: number = 0; + @State searchVideoList: SearchVideoImg[] = []; + @State searchInput: string = ''; + @Link isSearching: boolean; + + build() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[0], + lg: BreakpointConstants.GRID_COLUMN_SPANS[0] + } + }) { + Column() { + SearchHeader({ isSearching: $isSearching, searchInput: $searchInput, currentTopIndex: $currentTopIndex }) + SearchContent({ searchVideoList: $searchVideoList }) + .layoutWeight(1) + .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[0] || this.searchInput === + SearchConstants.SEARCH_INPUT_LIST[1] ? Visibility.None : Visibility.Visible) + SearchForHua({ searchInput: $searchInput }) + .layoutWeight(1) + .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[0] ? Visibility.Visible : + Visibility.None) + SearchResult() + .layoutWeight(1) + .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[1] ? Visibility.Visible : + Visibility.None) + } + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .padding({ + left: new BreakpointType($r('app.float.view_grid_col_padding_sm'), $r('app.float.view_grid_col_padding_md'), + $r('app.float.view_grid_col_padding_lg')).getValue(this.currentWidthBreakpoint), + right: new BreakpointType($r('app.float.view_grid_col_padding_sm'), $r('app.float.view_grid_col_padding_md'), + $r('app.float.view_grid_col_padding_lg')).getValue(this.currentWidthBreakpoint) + }) + } + } + .padding({ left: (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && (this.currentTopIndex === 2) ? + $r('app.float.search_view_grid_row_padding') : 0 }) + .onBreakpointChange((breakPoints) => { + this.searchVideoList = new SearchVideoImgModel().getTrendSearchList(breakPoints); + }) + } +} diff --git a/MultiVideoApplication/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets b/MultiVideoApplication/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e268f5cd0a012b231b14f8a28a03c896e9cd02c --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '@ohos/commons'; +import { SearchConstants } from '../constants/SearchConstants'; + +export class SearchVideoImgModel { + private trendingSearchList: SearchVideoImg[] = []; + private searchResultImgList: SearchVideoImg[] = []; + + constructor() { + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_1'), + SearchConstants.SEARCH_IMG_IMG_TITLES[0], SearchConstants.SEARCH_IMG_IMG_CONTENTS[0], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_2'), + SearchConstants.SEARCH_IMG_IMG_TITLES[1], SearchConstants.SEARCH_IMG_IMG_CONTENTS[1], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_3'), + SearchConstants.SEARCH_IMG_IMG_TITLES[2], SearchConstants.SEARCH_IMG_IMG_CONTENTS[2], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_4'), + SearchConstants.SEARCH_IMG_IMG_TITLES[3], SearchConstants.SEARCH_IMG_IMG_CONTENTS[3], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_5'), + SearchConstants.SEARCH_IMG_IMG_TITLES[4], SearchConstants.SEARCH_IMG_IMG_CONTENTS[4], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_6'), + SearchConstants.SEARCH_IMG_IMG_TITLES[5], SearchConstants.SEARCH_IMG_IMG_CONTENTS[5], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_7'), + SearchConstants.SEARCH_IMG_IMG_TITLES[6], SearchConstants.SEARCH_IMG_IMG_CONTENTS[6], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_8'), + SearchConstants.SEARCH_IMG_IMG_TITLES[7], SearchConstants.SEARCH_IMG_IMG_CONTENTS[7], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_9'), + SearchConstants.SEARCH_IMG_IMG_TITLES[8], SearchConstants.SEARCH_IMG_IMG_CONTENTS[8], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_10'), + SearchConstants.SEARCH_IMG_IMG_TITLES[9], SearchConstants.SEARCH_IMG_IMG_CONTENTS[9], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_11'), + SearchConstants.SEARCH_IMG_IMG_TITLES[10], SearchConstants.SEARCH_IMG_IMG_CONTENTS[10], '')); + this.trendingSearchList.push(new SearchVideoImg($r('app.media.search_video_12'), + SearchConstants.SEARCH_IMG_IMG_TITLES[11], SearchConstants.SEARCH_IMG_IMG_CONTENTS[11], '')); + this.searchResultImgList.push(new SearchVideoImg($r('app.media.search_result_1'), + SearchConstants.SEARCH_RESULT_TITLES[0], SearchConstants.SEARCH_RESULT_CONTENTS[0], + SearchConstants.SEARCH_RESULT_MORE[0])); + this.searchResultImgList.push(new SearchVideoImg($r('app.media.search_result_2'), + SearchConstants.SEARCH_RESULT_TITLES[1], SearchConstants.SEARCH_RESULT_CONTENTS[1], + SearchConstants.SEARCH_RESULT_MORE[1])); + this.searchResultImgList.push(new SearchVideoImg($r('app.media.search_result_3'), + SearchConstants.SEARCH_RESULT_TITLES[2], SearchConstants.SEARCH_RESULT_CONTENTS[2], + SearchConstants.SEARCH_RESULT_MORE[2])); + } + + getTrendSearchList(currentWidthBreakpoint: string): SearchVideoImg[] { + if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + return this.trendingSearchList.slice(0, 5); + } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.trendingSearchList.slice(0, 10); + } else { + return this.trendingSearchList; + } + } + + getSearchResultImgList(): SearchVideoImg[] { + return this.searchResultImgList; + } +} + +export class SearchVideoImg { + /** + * Image src of the video. + */ + private imgSrc: Resource; + + /** + * Title of the video. + */ + private title: ResourceStr; + + /** + * Content of the video. + */ + private content: ResourceStr; + + /** + * Other information of the video. + */ + private otherInfo: ResourceStr; + + constructor(imgSrc: Resource, title: ResourceStr, content: ResourceStr, otherInfo: ResourceStr) { + this.imgSrc = imgSrc; + this.title = title; + this.content = content; + this.otherInfo = otherInfo; + } + + getImgSrc(): Resource { + return this.imgSrc; + } + + getTitle(): ResourceStr { + return this.title; + } + + getContent(): ResourceStr { + return this.content; + } + + getOtherInfo(): ResourceStr { + return this.otherInfo; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/module.json5 b/MultiVideoApplication/features/search/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c3b61dabec00f0bf80f00358e2f75580864a7bcd --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "search", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/element/color.json b/MultiVideoApplication/features/search/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..02a3a2ab8e2d2290a63353bae8a7f3f263f53f4e --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/element/color.json @@ -0,0 +1,24 @@ +{ + "color": [ + { + "name": "type_tabs_font_selected", + "value": "#ED6F21" + }, + { + "name": "type_tabs_font", + "value": "#99000000" + }, + { + "name": "button_background_1", + "value": "#ED6F21" + }, + { + "name": "button_background_2", + "value": "#0D000000" + }, + { + "name": "result_background", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/element/float.json b/MultiVideoApplication/features/search/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..4e540261bc867bd420ac4825cdd7fccadb05143d --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/element/float.json @@ -0,0 +1,408 @@ +{ + "float": [ + { + "name": "search_history_title_font", + "value": "20fp" + }, + { + "name": "search_history_img_size", + "value": "24vp" + }, + { + "name": "search_history_title_margin", + "value": "12vp" + }, + { + "name": "search_history_title_height", + "value": "28vp" + }, + { + "name": "search_history_content_font", + "value": "12fp" + }, + { + "name": "search_history_content_height", + "value": "28vp" + }, + { + "name": "search_history_content_margin", + "value": "12vp" + }, + { + "name": "search_history_content_row_width", + "value": "64vp" + }, + { + "name": "search_history_content_row_height", + "value": "28vp" + }, + { + "name": "search_history_content_row_radius", + "value": "14vp" + }, + { + "name": "search_content_margin_right_sm", + "value": "8vp" + }, + { + "name": "search_content_margin_right_md", + "value": "16vp" + }, + { + "name": "search_content_margin_right_lg", + "value": "24vp" + }, + { + "name": "search_discovery_img_size", + "value": "16vp" + }, + { + "name": "search_discovery_img_margin", + "value": "24vp" + }, + { + "name": "search_discovery_row_height", + "value": "24vp" + }, + { + "name": "search_discovery_list_font", + "value": "16fp" + }, + { + "name": "search_discovery_list_column_height", + "value": "21vp" + }, + { + "name": "search_discovery_list_column_margin", + "value": "12vp" + }, + { + "name": "hot_trending_font", + "value": "16fp" + }, + { + "name": "hot_trending_line", + "value": "21vp" + }, + { + "name": "tabs_font_margin", + "value": "17vp" + }, + { + "name": "tabs_divider_margin", + "value": "8vp" + }, + { + "name": "tab_list_margin", + "value": "12vp" + }, + { + "name": "tab_divider_width", + "value": "32vp" + }, + { + "name": "hot_trending_tab_height", + "value": "56vp" + }, + { + "name": "hot_video_img_size", + "value": "48vp" + }, + { + "name": "hot_video_img_margin", + "value": "15vp" + }, + { + "name": "hot_video_title_font", + "value": "16fp" + }, + { + "name": "hot_video_title_line", + "value": "22vp" + }, + { + "name": "hot_video_title_margin", + "value": "15vp" + }, + { + "name": "hot_video_content_font", + "value": "14fp" + }, + { + "name": "hot_video_content_line", + "value": "19vp" + }, + { + "name": "hot_video_content_margin", + "value": "2vp" + }, + { + "name": "hot_video_row_height", + "value": "72vp" + }, + { + "name": "hot_video_list_height_sm", + "value": "384vp" + }, + { + "name": "hot_video_list_height", + "value": "312vp" + }, + { + "name": "hot_video_list_lane_space", + "value": "12vp" + }, + { + "name": "hot_video_list_padding", + "value": "12vp" + }, + { + "name": "search_hua_list_font", + "value": "16fp" + }, + { + "name": "search_hua_list_text_height", + "value": "47.5vp" + }, + { + "name": "search_hua_divider_height", + "value": "1vp" + }, + { + "name": "search_hua_column_height", + "value": "48vp" + }, + { + "name": "search_hua_column_margin_lg", + "value": "12vp" + }, + { + "name": "search_hua_list_padding", + "value": "16vp" + }, + { + "name": "search_header_back_img_size", + "value": "24vp" + }, + { + "name": "search_header_back_img_margin", + "value": "24vp" + }, + { + "name": "search_header_text_font", + "value": "16fp" + }, + { + "name": "search_header_text_height", + "value": "40vp" + }, + { + "name": "search_header_text_left", + "value": "36vp" + }, + { + "name": "search_header_text_right", + "value": "12vp" + }, + { + "name": "search_header_search_img_size", + "value": "16vp" + }, + { + "name": "search_header_search_img_margin", + "value": "12vp" + }, + { + "name": "search_header_row_height", + "value": "56vp" + }, + { + "name": "search_header_row_height_more", + "value": "92vp" + }, + { + "name": "search_header_row_padding", + "value": "36vp" + }, + { + "name": "type_tabs_font", + "value": "16fp" + }, + { + "name": "type_tabs_text_line", + "value": "22vp" + }, + { + "name": "type_tabs_text_margin", + "value": "17vp" + }, + { + "name": "type_tabs_divider_width_two", + "value": "32vp" + }, + { + "name": "type_tabs_divider_width_three", + "value": "48vp" + }, + { + "name": "type_tabs_divider_margin", + "value": "7vp" + }, + { + "name": "type_tabs_col_width", + "value": "48vp" + }, + { + "name": "type_tabs_col_margin", + "value": "16vp" + }, + { + "name": "sift_img_size", + "value": "16vp" + }, + { + "name": "type_tabs_row_height", + "value": "56vp" + }, + { + "name": "type_tabs_row_margin", + "value": "12vp" + }, + { + "name": "search_result_font", + "value": "16fp" + }, + { + "name": "search_result_row_height", + "value": "48vp" + }, + { + "name": "search_result_row_margin", + "value": "8vp" + }, + { + "name": "result_card_content_line_lg", + "value": "19vp" + }, + { + "name": "result_card_content_line", + "value": "16vp" + }, + { + "name": "grid_row_gutter", + "value": "12vp" + }, + { + "name": "search_result_title_font_sm", + "value": "14fp" + }, + { + "name": "search_result_title_font_md", + "value": "16fp" + }, + { + "name": "search_result_title_font_lg", + "value": "18fp" + }, + { + "name": "search_result_content_font_sm", + "value": "10fp" + }, + { + "name": "search_result_content_font_md", + "value": "12fp" + }, + { + "name": "search_result_content_font_lg", + "value": "14fp" + }, + { + "name": "search_result_content_margin", + "value": "4vp" + }, + { + "name": "search_result_more_margin", + "value": "2vp" + }, + { + "name": "search_result_button_radius", + "value": "12.5vp" + }, + { + "name": "search_result_button_font_lg", + "value": "14fp" + }, + { + "name": "search_result_button_font", + "value": "12fp" + }, + { + "name": "search_result_button_height_lg", + "value": "34vp" + }, + { + "name": "search_result_button_height", + "value": "25vp" + }, + { + "name": "search_result_button_blank_md", + "value": "20vp" + }, + { + "name": "search_result_button_blank", + "value": "6vp" + }, + { + "name": "result_list_row_height_sm", + "value": "179vp" + }, + { + "name": "result_list_row_height_md", + "value": "198vp" + }, + { + "name": "result_list_row_height_lg", + "value": "238vp" + }, + { + "name": "result_list_row_padding_sm", + "value": "10vp" + }, + { + "name": "result_list_row_padding", + "value": "12vp" + }, + { + "name": "result_list_row_radius", + "value": "16vp" + }, + { + "name": "result_grid_row_margin", + "value": "12vp" + }, + { + "name": "view_grid_col_padding_sm", + "value": "16vp" + }, + { + "name": "view_grid_col_padding_md", + "value": "24vp" + }, + { + "name": "view_grid_col_padding_lg", + "value": "32vp" + }, + { + "name": "previous_one_image_margin_sm", + "value": "10vp" + }, + { + "name": "previous_one_image_margin", + "value": "12vp" + }, + { + "name": "search_view_grid_row_padding", + "value": "96vp" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/element/string.json b/MultiVideoApplication/features/search/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5a8df8baffa27a35abfd5310dc11a0c3121ef4e4 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/element/string.json @@ -0,0 +1,104 @@ +{ + "string": [ + { + "name": "search", + "value": "搜索发现1" + }, + { + "name": "top", + "value": "热搜" + }, + { + "name": "theater", + "value": "剧场" + }, + { + "name": "movie", + "value": "电影" + }, + { + "name": "variety", + "value": "综艺" + }, + { + "name": "anime", + "value": "动漫" + }, + { + "name": "children", + "value": "儿童" + }, + { + "name": "records", + "value": "记录" + }, + { + "name": "tv", + "value": "华为会员电视剧场" + }, + { + "name": "cultural", + "value": "建筑人文史迹" + }, + { + "name": "europe", + "value": "欧洲建筑的历史责任在载对欧洲建筑风格的形成和" + }, + { + "name": "history_search", + "value": "搜索历史" + }, + { + "name": "content", + "value": "搜索内容" + }, + { + "name": "find", + "value": "搜索发现" + }, + { + "name": "search1", + "value": "搜索..." + }, + { + "name": "conference", + "value": "华为发布会" + }, + { + "name": "all", + "value": "All" + }, + { + "name": "filmer", + "value": "影视" + }, + { + "name": "video", + "value": "短视频" + }, + { + "name": "user", + "value": "用户" + }, + { + "name": "flagship", + "value": "华为旗舰新品发布会" + }, + { + "name": "press", + "value": "发布会 · 华为终端 · 202..." + }, + { + "name": "plays", + "value": "9.8万次播放" + }, + { + "name": "player", + "value": "播放" + }, + { + "name": "cache", + "value": "缓存" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_back.svg b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_delete.svg b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_delete.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cf1fcee8aab4df5b3b8272f3ed894a8465cf287 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_delete.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_delete + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_rotate.svg b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_rotate.svg new file mode 100644 index 0000000000000000000000000000000000000000..28138305dbc03eca10e951aab12c2d2475e1a4e1 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_rotate.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_rotate + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_search.svg b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..423182ce01e353a362155bdb443b9686672631d9 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_search.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_search + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_sift.svg b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_sift.svg new file mode 100644 index 0000000000000000000000000000000000000000..86b8beb0836f3352024fb6948658e198e5dfca17 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/base/media/ic_public_sift.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_sift + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_1.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_1.png new file mode 100644 index 0000000000000000000000000000000000000000..c59cd47d89a9c75a5ccf2b1491333f2ce3269419 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_1.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_2.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_2.png new file mode 100644 index 0000000000000000000000000000000000000000..1c3297b0ba93f302411b06d698bb8c9cf07c4659 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_2.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_3.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_3.png new file mode 100644 index 0000000000000000000000000000000000000000..e38839c94baf4bc120ee9312c46684a8a5b61b1c Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_result_3.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_1.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..776e486a465ec2575db3447b07de146257f0c5af Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_1.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_10.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_10.png new file mode 100644 index 0000000000000000000000000000000000000000..7f5c304e54fc0d8674ca0afcb3cd0b747e6d405e Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_10.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_11.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_11.png new file mode 100644 index 0000000000000000000000000000000000000000..2eda12fc49bd550bfc946fedc2ad496ee3f5bf67 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_11.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_12.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_12.png new file mode 100644 index 0000000000000000000000000000000000000000..797026b44ef7563378232dbc077d752a76e31d8b Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_12.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_2.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4455b03b5a116d32a7153ee70a0d5fc0c18dd504 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_2.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_3.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..5e5765655f7b6953185d10baf9ecb750aa867f90 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_3.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_4.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..7f02cd9850bb352da78d1199b75231408504e56e Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_4.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_5.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_5.png new file mode 100644 index 0000000000000000000000000000000000000000..38602deca002b8f412e7fadd7508f45024b4269f Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_5.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_6.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_6.png new file mode 100644 index 0000000000000000000000000000000000000000..6b3f69579f9386234dc906ed2c982fd21b414933 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_6.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_7.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_7.png new file mode 100644 index 0000000000000000000000000000000000000000..fc0eb12f1b00876e6ef73b09b589a70c6afb90fc Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_7.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_8.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_8.png new file mode 100644 index 0000000000000000000000000000000000000000..bbf9008162cd051255c5dce69af477ccebb90886 Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_8.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_9.png b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_9.png new file mode 100644 index 0000000000000000000000000000000000000000..5bf0bc5f81279a3561e81519a4f47c1958ac473a Binary files /dev/null and b/MultiVideoApplication/features/search/src/main/resources/base/media/search_video_9.png differ diff --git a/MultiVideoApplication/features/search/src/main/resources/en_US/element/string.json b/MultiVideoApplication/features/search/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..557986b70b93b32e3443ea30df05b3dc79359dd3 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/en_US/element/string.json @@ -0,0 +1,104 @@ +{ + "string": [ + { + "name": "search", + "value": "Search 1" + }, + { + "name": "top", + "value": "top" + }, + { + "name": "theater", + "value": "theater" + }, + { + "name": "movie", + "value": "movie" + }, + { + "name": "variety", + "value": "variety" + }, + { + "name": "anime", + "value": "anime" + }, + { + "name": "children", + "value": "children" + }, + { + "name": "records", + "value": "records" + }, + { + "name": "tv", + "value": "Huawei member TV Theater" + }, + { + "name": "cultural", + "value": "Architectural cultural and historical sites" + }, + { + "name": "europe", + "value": "The historical responsibility of European architecture lies in the formation and development of European architectural styles" + }, + { + "name": "history_search", + "value": "Search history" + }, + { + "name": "content", + "value": "content" + }, + { + "name": "find", + "value": "Search and find" + }, + { + "name": "search1", + "value": "Search..." + }, + { + "name": "conference", + "value": "Huawei Conference" + }, + { + "name": "all", + "value": "all" + }, + { + "name": "filmer", + "value": "film" + }, + { + "name": "video", + "value": "video" + }, + { + "name": "user", + "value": "user" + }, + { + "name": "flagship", + "value": "Huawei's flagship product launch event" + }, + { + "name": "press", + "value": "Conference · Huawei Terminal · 202..." + }, + { + "name": "plays", + "value": "98,000 plays" + }, + { + "name": "player", + "value": "play" + }, + { + "name": "cache", + "value": "cache" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/search/src/main/resources/zh_CN/element/string.json b/MultiVideoApplication/features/search/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5a8df8baffa27a35abfd5310dc11a0c3121ef4e4 --- /dev/null +++ b/MultiVideoApplication/features/search/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,104 @@ +{ + "string": [ + { + "name": "search", + "value": "搜索发现1" + }, + { + "name": "top", + "value": "热搜" + }, + { + "name": "theater", + "value": "剧场" + }, + { + "name": "movie", + "value": "电影" + }, + { + "name": "variety", + "value": "综艺" + }, + { + "name": "anime", + "value": "动漫" + }, + { + "name": "children", + "value": "儿童" + }, + { + "name": "records", + "value": "记录" + }, + { + "name": "tv", + "value": "华为会员电视剧场" + }, + { + "name": "cultural", + "value": "建筑人文史迹" + }, + { + "name": "europe", + "value": "欧洲建筑的历史责任在载对欧洲建筑风格的形成和" + }, + { + "name": "history_search", + "value": "搜索历史" + }, + { + "name": "content", + "value": "搜索内容" + }, + { + "name": "find", + "value": "搜索发现" + }, + { + "name": "search1", + "value": "搜索..." + }, + { + "name": "conference", + "value": "华为发布会" + }, + { + "name": "all", + "value": "All" + }, + { + "name": "filmer", + "value": "影视" + }, + { + "name": "video", + "value": "短视频" + }, + { + "name": "user", + "value": "用户" + }, + { + "name": "flagship", + "value": "华为旗舰新品发布会" + }, + { + "name": "press", + "value": "发布会 · 华为终端 · 202..." + }, + { + "name": "plays", + "value": "9.8万次播放" + }, + { + "name": "player", + "value": "播放" + }, + { + "name": "cache", + "value": "缓存" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/Index.ets b/MultiVideoApplication/features/videoDetail/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/MultiVideoApplication/features/videoDetail/build-profile.json5 b/MultiVideoApplication/features/videoDetail/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3167e54d1ff3a0aaa0cdcf4319789de8e3f3c350 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/build-profile.json5 @@ -0,0 +1,10 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/hvigorfile.ts b/MultiVideoApplication/features/videoDetail/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiVideoApplication/features/videoDetail/oh-package.json5 b/MultiVideoApplication/features/videoDetail/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..79a3942bc872db5d1af2d2340775a4271aa5a74a --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "videodetail", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/constants/DetailConstants.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/constants/DetailConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..531116d10911d096aac4664d967b879af33c166b --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/constants/DetailConstants.ets @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2023 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 class DetailConstants { + /** + * Initial comment image height. + */ + static readonly INITIAL_COMMENT_IMAGE_HEIGHT: string = '150vp'; + /** + * Initial comment image width. + */ + static readonly INITIAL_COMMENT_IMAGE_WIDTH: string = '219vp'; + /** + * Initial related video height. + */ + static readonly INITIAL_RELATED_VIDEO_HEIGHT: number = 169; + /** + * Initial related video height. + */ + static readonly INITIAL_VIDEO_HEIGHT: number = 100; + /** + * Comment image min height number. + */ + static readonly COMMENT_IMAGE_MIN_HEIGHT_NUMBER: number = 150; + /** + * Comment image min width number. + */ + static readonly COMMENT_IMAGE_MIN_WIDTH_NUMBER: number = 219; + /** + * Comment image max height number. + */ + static readonly COMMENT_IMAGE_MAX_HEIGHT_NUMBER: number = 182; + /** + * Comment image max width number. + */ + static readonly COMMENT_IMAGE_MAX_WIDTH_NUMBER: number = 266; + /** + * Side bar min width number. + */ + static readonly SIDE_BAR_MIN_WIDTH_NUMBER: number = 320; + /** + * Offset for scrolling to top. + */ + static readonly SCROLL_TO_TOP: string = '{"xOffset":0,"yOffset":0}'; + /** + * Sub title list. + */ + static readonly SUB_TITLES: ResourceStr[] = + [$r('app.string.comments'), $r('app.string.related'), $r('app.string.more'), $r('app.string.introduction'), + $r('app.string.anthology'), $r('app.string.Peripheral')]; + /** + * Comment image aspect ratio. + */ + static readonly COMMENT_IMAGE_ASPECT_RATIO: number = 1.46; + /** + * Comment image width list. + */ + static readonly COMMENT_IMAGE_WIDTH: string[] = ['227vp', '371vp']; + /** + * Comment image height list. + */ + static readonly COMMENT_IMAGE_HEIGHT: string[] = ['155vp', '254vp']; + /** + * Episodes list. + */ + static readonly EPISODES_LIST: string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']; + /** + * Length unit. + */ + static readonly LENGTH_UNIT: string = 'vp'; + /** + * Introduction content. + */ + static readonly INTRODUCTION_CONTENT: ResourceStr[] = [$r('app.string.product'), + $r('app.string.play')]; + /** + * Icon list. + */ + static readonly ICON_LIST: Resource[] = [$r('app.media.ic_public_favor'), $r('app.media.ic_public_comments'), + $r('app.media.ic_public_thumb_sup'), $r('app.media.ic_public_download'), $r('app.media.ic_public_share')]; + /** + * Shadow radius. + */ + static readonly SHADOW_RADIUS: number = 50; + /** + * Shadow offset y. + */ + static readonly SHADOW_OFFSET_Y: number = 10; + /** + * Percent sign. + */ + static readonly PERCENT_SIGN: string = '%'; + /** + * Related video title list. + */ + static readonly RELATED_VIDEO_TITLES: ResourceStr[] = + [$r('app.string.released'), $r('app.string.released'), $r('app.string.released'), + $r('app.string.released'), $r('app.string.released'), $r('app.string.released'), $r('app.string.released')]; + /** + * Peripheral video title list. + */ + static readonly PERIPHERAL_VIDEO_TITLE: ResourceStr[] = [$r('app.string.series'), $r('app.string.series'), + $r('app.string.series'), $r('app.string.series'), $r('app.string.series')]; + /** + * User info name list. + */ + static readonly USER_INFO_NAMES: string[] = ['m******', 'H******', 'BEI***']; + /** + * User info comment list. + */ + static readonly USER_INFO_COMMENTS: ResourceStr[] = [ + $r('app.string.feel'), + $r('app.string.love'), + $r('app.string.design') + ]; + /** + * User info date. + */ + static readonly USER_INFO_DATE: ResourceStr = $r('app.string.July'); + /** + * Placeholder of comment text input. + */ + static readonly COMMENT_PLACEHOLDER: ResourceStr = $r('app.string.comment'); + /** + * Min video percent. + */ + static readonly MIN_VIDEO_PERCENT: number = 53; + /** + * Max video percent. + */ + static readonly MAX_VIDEO_PERCENT: number = 100; + /** + * Ten. + */ + static readonly TEN: number = 10; + /** + * Related list height. + */ + static readonly RELATED_LIST_HEIGHT: number = 169; + /** + * Full-screen page url. + */ + static readonly FULL_SCREEN_URL: string = '@bundle:com.huawei.videoapplication/videoPlayer/ets/pages/Index'; + /** + * Comments area percent. + */ + static readonly COMMENTS_AREA_PERCENT: number = 0.4; + /** + * Player text list. + */ + static readonly PLAYER_TEXT_LIST: ResourceStr[] = [$r('app.string.selections'), $r('app.string.just'), + $r('app.string.super'), $r('app.string.speed')]; + /** + * Episode list lanes list. + */ + static readonly EPISODE_LIST_LANES: number[] = [8, 4]; + /** + * Episodes. + */ + static readonly PLAYER_EPISODE: string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', + '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']; +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/utils/CurrentOffsetUtil.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/utils/CurrentOffsetUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6d788c8cb4f638f36d29e888ad4252f972cae08 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/utils/CurrentOffsetUtil.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DetailConstants } from '../constants/DetailConstants'; + +export class CurrentOffsetUtil { + static scrollToTop(offset: string): boolean { + if (offset === DetailConstants.SCROLL_TO_TOP) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/AllComments.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/AllComments.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfb249792674c649ed3b6557215ee7e3458ff0f7 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/AllComments.ets @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { BreakpointType } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { UserInfo, UserViewModel } from '../viewmodel/UserViewModel'; + +@Component +export struct AllComments { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @Link commentImgHeight: string; + @Link commentImgWidth: string; + private commentsList: UserInfo[] = new UserViewModel().getRelatedVideoList(); + + build() { + Column() { + Row() { + this.TitleText(DetailConstants.SUB_TITLES[0]) + } + .padding({ + left: $r('app.float.all_comments_title_row_padding'), + right: $r('app.float.all_comments_title_row_padding') + }) + .height($r('app.float.all_comments_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + + Column() { + ForEach(this.commentsList, (item: UserInfo, index: number) => { + Row() { + Image(item.getImageSrc()) + .height($r('app.float.all_comments_profile_size')) + .width($r('app.float.all_comments_profile_size')) + .margin({ right: $r('app.float.all_comments_profile_margin') }) + + this.TitleText(item.getName()) + } + .height($r('app.float.all_comments_title_row_height')) + .width(CommonConstants.FULL_PERCENT) + .margin({ top: $r('app.float.all_comments_title_margin') }) + .alignItems(VerticalAlign.Center) + + Row() { + Text(item.getComment()) + .margin({ left: $r('app.float.all_comments_comment_left') }) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontSize( $r('app.float.all_comments_comment_font')) + .lineHeight( $r('app.float.all_comments_comment_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .margin({ top: $r('app.float.all_comments_comment_row_top') }) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + + Row() { + // [Start all_comments_image] + Image(item.getCommentImageSrc()) + .width(new BreakpointType(DetailConstants.COMMENT_IMAGE_WIDTH[0], DetailConstants.COMMENT_IMAGE_WIDTH[1], + this.commentImgWidth).getValue(this.currentWidthBreakpoint)) + .height(new BreakpointType(DetailConstants.COMMENT_IMAGE_HEIGHT[0], + DetailConstants.COMMENT_IMAGE_HEIGHT[1], this.commentImgHeight).getValue(this.currentWidthBreakpoint)) + .borderRadius( $r('app.float.all_comments_img_radius')) + .aspectRatio(DetailConstants.COMMENT_IMAGE_ASPECT_RATIO) + // [End all_comments_image] + } + .padding({ left: $r('app.float.all_comments_img_row_padding') }) + .margin({ top: $r('app.float.all_comments_img_row_margin') }) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + .visibility(!item.getCommentImageSrc() ? Visibility.None : Visibility.Visible) + + Row() { + Text(item.getTime()) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontSize($r('app.float.all_comments_comment_time_font')) + .lineHeight($r('app.float.all_comments_comment_time_line')) + .fontWeight(FontWeight.Normal) + .margin({ left: $r('app.float.all_comments_comment_time_margin') }) + + Blank() + + IconImage({ image: $r('app.media.ic_public_comments') }) + .margin({ right: $r('app.float.all_comments_icon_margin') }) + IconImage({ image: $r("app.media.ic_public_thumb_sup") }) + .margin({ right: $r('app.float.all_comments_icon_margin') }) + IconImage({ image: $r('app.media.ic_public_share') }) + } + .margin({ top: $r('app.float.all_comments_icon_row_top') }) + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + + Divider() + .color(Color.Black) + .opacity(CommonConstants.DIVIDER_OPACITY) + .margin({ + top: $r('app.float.all_comments_divider_margin') + }) + .height($r('app.float.all_comments_divider_height')) + .width(CommonConstants.FULL_PERCENT) + .visibility(index === this.commentsList.length - 1 ? Visibility.None : Visibility.Visible) + }, (item: UserInfo, index: number) => index + JSON.stringify(item)) + } + .alignItems(HorizontalAlign.Start) + .padding({ + left: $r('app.float.all_comments_comment_col_padding'), + right: $r('app.float.all_comments_comment_col_padding') + }) + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.Start) + } + + @Builder + TitleText(content: ResourceStr) { + Text(content) + .fontSize($r('app.float.all_comments_title_text_font')) + .lineHeight($r('app.float.all_comments_title_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } +} + +@Component +struct IconImage { + public image: Resource | null = null; + + build() { + Image(this.image) + .height($r('app.float.all_comments_icon_size')) + .width($r('app.float.all_comments_icon_size')) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/FooterEpisodes.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/FooterEpisodes.ets new file mode 100644 index 0000000000000000000000000000000000000000..c30be49d8eba1ff9309a4eb0f012c9a5b2ed51a7 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/FooterEpisodes.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct FooterEpisodes { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentHeightBreakpoint') currentHeightBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isFullScreen') isFullScreen: boolean = false; + @Link isShowingSideBar: boolean; + @Link foldStatus: display.FoldStatus; + + build() { + Column() { + // Selection bottom bar. + Row() { + Text(DetailConstants.PLAYER_TEXT_LIST[0]) + .fontSize($r('app.float.title_selected_font')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .lineHeight($r('app.float.title_selected_line')) + .width($r('app.float.title_selected_width')) + .margin({ right: $r('app.float.title_selected_margin') }) + Text(DetailConstants.PLAYER_TEXT_LIST[1]) + .fontSize($r('app.float.title_font')) + .fontColor(Color.White) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.title_line')) + .width($r('app.float.title_width')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + } + .margin({ + top: $r('app.float.title_row_top'), + bottom: $r('app.float.title_row_bottom') + }) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.title_row_height')) + + List({ space: CommonConstants.LIST_SPACE }) { + ForEach(DetailConstants.PLAYER_EPISODE, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize($r('app.float.title_font')) + .fontColor(index === 1 ? $r('app.color.font_selected') : Color.White) + .fontWeight(FontWeight.Normal) + + Image($r('app.media.video_playing')) + .height($r('app.float.playing_size')) + .width($r('app.float.playing_size')) + .position({ + x: $r('app.float.playing_position_x'), + y: $r('app.float.playing_position_y') + }) + .visibility(index === 1 ? Visibility.Visible : Visibility.None) + } + .justifyContent(FlexAlign.Center) + .borderRadius($r('app.float.episode_row_radius')) + .backgroundColor($r('app.color.episode_row_background')) + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.episode_row_height')) + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .edgeEffect(EdgeEffect.None) + .scrollBar(BarState.Off) + .width(CommonConstants.FULL_PERCENT) + .layoutWeight(1) + .padding({ bottom: $r('app.float.episode_list_bottom') }) + .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD ? DetailConstants.EPISODE_LIST_LANES[0] : + DetailConstants.EPISODE_LIST_LANES[1], $r('app.float.episode_list_lanes_space')) + } + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.isShowingFooter()) + .backgroundColor(Color.Black) + .padding({ + left: $r('app.float.episode_col_padding'), + right: $r('app.float.episode_col_padding') + }) + } + + isShowingFooter(): Visibility { + if (!this.isShowingSideBar || !this.isFullScreen) { + return Visibility.None; + } + if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE) { + return this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None; + } + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint !== + BreakpointConstants.BREAKPOINT_SM) { + return Visibility.Visible; + } + return Visibility.None; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/RelatedList.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/RelatedList.ets new file mode 100644 index 0000000000000000000000000000000000000000..816636e8be9a921b9aa3f98e1491729575d242ab --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/RelatedList.ets @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { CurrentOffsetUtil } from '../utils/CurrentOffsetUtil'; +import { RelatedVideo, RelatedVideoViewModel } from '../viewmodel/RelatedVideoViewModel'; +import { AllComments } from './AllComments'; + +@Component +export struct RelatedList { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isFullScreen') isFullScreen: boolean = false; + @State commentImgHeight: string = DetailConstants.INITIAL_COMMENT_IMAGE_HEIGHT; + @State commentImgWidth: string = DetailConstants.INITIAL_COMMENT_IMAGE_WIDTH; + @Link relatedVideoHeight: number; + @Link videoHeight: number; + public screenHeight: number = 0; + private relatedVideoList: RelatedVideo[] = new RelatedVideoViewModel().getRelatedVideoList(); + private peripheralVideoList: RelatedVideo[] = new RelatedVideoViewModel().getPeripheralVideoList(); + private episodes: string[] = DetailConstants.EPISODES_LIST; + private currentIndex: number = 2; + private iconList: Resource[] = DetailConstants.ICON_LIST; + private scroller: Scroller = new Scroller(); + // [Start related_list_build] + build() { + Scroll(this.scroller) { + Column() { + this.RelatedVideoComponent() + this.VideoIntroduction() + AllComments({commentImgHeight: this.commentImgHeight, commentImgWidth: this.commentImgWidth}) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.None : + Visibility.Visible) + } + .width(CommonConstants.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + .padding({ bottom: $r('app.float.video_col_padding') }) + } + .layoutWeight(1) + .scrollBar(BarState.Off) + .visibility(!this.isFullScreen ? Visibility.Visible : Visibility.None) + .onScrollFrameBegin((offset: number) => { + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + if ((offset > 0) && (this.videoHeight > DetailConstants.MIN_VIDEO_PERCENT)) { + // Video zoom-out logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + // Video shrinkage percentage. + let heightOffset = offsetPercent < this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT ? offsetPercent : + this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT; + this.videoHeight = this.videoHeight - heightOffset; + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } else if ((offset < 0) && (this.videoHeight < DetailConstants.MAX_VIDEO_PERCENT) && + (CurrentOffsetUtil.scrollToTop(JSON.stringify(this.scroller.currentOffset())))) { + // Video magnification logic. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + let heightOffset = offsetPercent < DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight ? offsetPercent : + DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight; + this.videoHeight = this.videoHeight + heightOffset; + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } + return { offsetRemain: offset }; + } else { + if ((offset > 0) && (this.videoHeight === DetailConstants.MAX_VIDEO_PERCENT) && (this.relatedVideoHeight > 0)) { + // Related list shrinking logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.TEN) / this.screenHeight; + this.relatedVideoHeight = (this.relatedVideoHeight - offsetPercent * DetailConstants.RELATED_LIST_HEIGHT) < + 0 ? 0 : (this.relatedVideoHeight - offsetPercent * DetailConstants.RELATED_LIST_HEIGHT); + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } else if ((offset > 0) && (this.videoHeight > DetailConstants.MIN_VIDEO_PERCENT) && + (this.relatedVideoHeight === 0)) { + // Video zoom-out logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + // Video shrinkage percentage. + let heightOffset = offsetPercent < this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT ? offsetPercent : + this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT; + this.videoHeight = this.videoHeight - heightOffset; + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } else if ((offset > 0) && (this.videoHeight === DetailConstants.MIN_VIDEO_PERCENT) && + (this.relatedVideoHeight === 0)) { + return { offsetRemain: offset }; + } else if ((offset < 0) && (this.videoHeight < DetailConstants.MAX_VIDEO_PERCENT) && + (this.relatedVideoHeight === 0)) { + if (CurrentOffsetUtil.scrollToTop(JSON.stringify(this.scroller.currentOffset()))) { + // Video magnification logic. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + let heightOffset = offsetPercent < DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight ? offsetPercent : + DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight; + this.videoHeight = this.videoHeight + heightOffset; + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } + return { offsetRemain: offset }; + } else if ((offset < 0) && (this.videoHeight === DetailConstants.MAX_VIDEO_PERCENT) && + (this.relatedVideoHeight >= 0)) { + // Related list enlargement logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.TEN) / this.screenHeight; + this.relatedVideoHeight = (this.relatedVideoHeight + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT) > + DetailConstants.RELATED_LIST_HEIGHT ? DetailConstants.RELATED_LIST_HEIGHT : (this.relatedVideoHeight + + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT); + // Returns the actual offset 0. + return { offsetRemain: 0 }; + } + return { offsetRemain: 0 }; + } + }) + } + // [End related_list_build] + + @Builder + RelatedVideoComponent() { + Column() { + this.SubTitleAndMore(DetailConstants.SUB_TITLES[1]) + + Row() { + List({ space: CommonConstants.LIST_SPACE }) { + ForEach(this.relatedVideoList, (item: RelatedVideo, index: number) => { + ListItem() { + Column() { + Image(item.getImageSrc()) + .height($r('app.float.related_img_height')) + .width($r('app.float.related_img_width')) + .objectFit(ImageFit.Cover) + .borderRadius($r('app.float.related_img_radius')) + .margin({ bottom: $r('app.float.related_img_margin') }) + + Text(item.getName()) + .fontSize($r('app.float.related_name_font')) + .lineHeight($r('app.float.related_name_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontColor(index === 0 ? $r('app.color.episodes_font') : Color.Black) + } + } + .margin({ + top: $r('app.float.related_list_top'), + bottom: $r('app.float.related_list_bottom') + }) + }, (item: RelatedVideo, index: number) => index + JSON.stringify(item)) + } + .listDirection(Axis.Horizontal) + .scrollBar(BarState.Off) + } + .padding({ + left: $r('app.float.related_row_left'), + bottom: $r('app.float.related_row_bottom') + }) + .height($r('app.float.related_row_height')) + .width(CommonConstants.FULL_PERCENT) + } + .height(this.relatedVideoHeight + DetailConstants.LENGTH_UNIT) + } + + // [Start related_list] + @Builder + VideoIntroduction() { + Column() { + // [StartExclude related_list] + this.SubTitle(DetailConstants.SUB_TITLES[3]) + + Column() { + this.IntroductionContent(DetailConstants.INTRODUCTION_CONTENT[0]) + this.IntroductionContent(DetailConstants.INTRODUCTION_CONTENT[1]) + } + .padding({ + left: $r('app.float.sub_title_row_padding'), + right: $r('app.float.sub_title_row_padding') + }) + .width(CommonConstants.FULL_PERCENT) + .alignItems(HorizontalAlign.Start) + // [EndExclude related_list] + Row() { + ForEach(this.iconList, (item: Resource, index: number) => { + Image(item) + .height($r('app.float.introduction_icon_size')) + .width($r('app.float.introduction_icon_size')) + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .justifyContent(FlexAlign.SpaceBetween) + // [StartExclude related_list] + .padding({ + top: $r('app.float.introduction_row_padding'), + bottom: $r('app.float.introduction_row_padding'), + left: $r('app.float.sub_title_row_padding'), + right: $r('app.float.sub_title_row_padding') + }) + .height($r('app.float.sub_title_row_height_detail')) + .width(CommonConstants.FULL_PERCENT) + + this.SubTitle(DetailConstants.SUB_TITLES[4]) + // [EndExclude related_list] + + List({ space: CommonConstants.LIST_SPACE }) { + ForEach(this.episodes, (item: string, index: number) => { + ListItem() { + // [StartExclude related_list] + Row() { + Image($r('app.media.video_playing')) + .height($r('app.float.is_playing_icon_size')) + .width($r('app.float.is_playing_icon_size')) + .position({ x: $r('app.float.is_playing_icon_x'), y: $r('app.float.is_playing_icon_y') }) + .visibility((index + 1) === this.currentIndex ? Visibility.Visible : Visibility.None) + + Text(item) + .fontSize($r('app.float.episodes_text_font')) + .fontWeight(FontWeight.Normal) + .height($r('app.float.episodes_text_height')) + .fontColor((index + 1) === this.currentIndex ? $r('app.color.episodes_font') : Color.Black) + } + .justifyContent(FlexAlign.Center) + .backgroundColor($r('app.color.episodes_background')) + .height($r('app.float.episodes_list_height')) + .width($r('app.float.episodes_list_width')) + .borderRadius($r('app.float.episodes_list_radius')) + // [EndExclude related_list] + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .padding({ left: $r('app.float.sub_title_row_padding') }) + .margin({ bottom: $r('app.float.episodes_list_margin') }) + .width(CommonConstants.FULL_PERCENT) + + this.SubTitleAndMore(DetailConstants.SUB_TITLES[5]) + // [StartExclude related_list] + List({ space: CommonConstants.LIST_SPACE }) { + ForEach(this.peripheralVideoList, (item: RelatedVideo, index: number) => { + ListItem() { + Column() { + Image(item.getImageSrc()) + .height($r('app.float.peripheral_img_height')) + .width($r('app.float.peripheral_img_width')) + .margin({ bottom: $r('app.float.peripheral_img_margin') }) + .borderRadius($r('app.float.peripheral_img_radius')) + + Text(item.getName()) + .lineHeight($r('app.float.peripheral_name_line')) + .fontSize($r('app.float.peripheral_name_font')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + } + }, (item: RelatedVideo, index: number) => index + JSON.stringify(item)) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .margin({ top: $r('app.float.peripheral_list_margin') }) + .padding({ + left: $r('app.float.sub_title_row_padding'), + right: $r('app.float.sub_title_row_padding') + }) + .width(CommonConstants.FULL_PERCENT) + // [EndExclude related_list] + } + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + } + // [StartExclude related_list] + @Builder + SubTitle(subtitle: ResourceStr) { + Row() { + Text(subtitle) + .fontSize($r('app.float.sub_title_font')) + .lineHeight($r('app.float.sub_title_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .padding({ + left: $r('app.float.sub_title_row_padding'), + right: $r('app.float.sub_title_row_padding') + }) + .height($r('app.float.sub_title_row_height_detail')) + .width(CommonConstants.FULL_PERCENT) + } + // [EndExclude related_list] + + @Builder + SubTitleAndMore(subtitle: ResourceStr) { + Row() { + // [StartExclude related_list] + Text(subtitle) + .fontSize($r('app.float.sub_title_font')) + .lineHeight($r('app.float.sub_title_text_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + // [EndExclude related_list] + Blank() + // [StartExclude related_list] + Text(DetailConstants.SUB_TITLES[2]) + .fontSize($r('app.float.sub_title_font_more')) + .lineHeight($r('app.float.sub_title_text_line_more')) + .fontWeight(FontWeight.Normal) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Image($r('app.media.ic_public_arrow_right')) + .height($r('app.float.arrow_img_size')) + .width($r('app.float.arrow_img_size')) + // [EndExclude related_list] + } + .padding({ + left: $r('app.float.sub_title_row_padding'), + right: $r('app.float.sub_title_row_padding') + }) + .height($r('app.float.sub_title_row_height_detail')) + .width(CommonConstants.FULL_PERCENT) + .alignItems(VerticalAlign.Center) + } + // [End related_list] + + @Builder + IntroductionContent(content: ResourceStr) { + Text(content) + .fontSize($r('app.float.introduction_content_font')) + .lineHeight($r('app.float.introduction_content_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .opacity(CommonConstants.TEXT_OPACITY[2]) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/SelfComment.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/SelfComment.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5486af0c627210099d01cea19835716d38fabb4 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/SelfComment.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { deviceInfo } from '@kit.BasicServicesKit'; +import { CommonConstants } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; +import { UserInfo, UserViewModel } from '../viewmodel/UserViewModel'; + +@Component +export struct SelfComment { + private selfInfo: UserInfo = new UserViewModel().getSelfInfo(); + + build() { + Row() { + Image(this.selfInfo.getImageSrc()) + .height($r('app.float.self_comment_profile_size')) + .width($r('app.float.self_comment_profile_size')) + .borderRadius($r('app.float.self_comment_profile_radius')) + .margin({ + left: $r('app.float.self_comment_profile_left'), + right: $r('app.float.self_comment_profile_right') + }) + + Stack({ alignContent: Alignment.Start }) { + Row() { + Image($r('app.media.ic_public_emoji')) + .height($r('app.float.self_comment_emoji_size')) + .width($r('app.float.self_comment_emoji_size')) + .margin({ right: $r('app.float.self_comment_emoji_margin') }) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.End) + .alignItems(VerticalAlign.Center) + + Image($r('app.media.ic_public_comment')) + .height($r('app.float.self_comment_comment_size')) + .width($r('app.float.self_comment_comment_size')) + .margin({ + top: $r('app.float.self_comment_comment_margin'), + bottom: $r('app.float.self_comment_comment_margin'), + left: $r('app.float.self_comment_comment_margin'), + right: $r('app.float.self_comment_comment_right') + }) + + TextInput({ placeholder: DetailConstants.COMMENT_PLACEHOLDER }) + .placeholderFont({ + size: $r('app.float.self_comment_input_font'), + weight: FontWeight.Normal + }) + .height($r('app.float.self_comment_input_height')) + .fontSize($r('app.float.self_comment_input_font')) + .padding({ + left: $r('app.float.self_comment_input_left'), + right: $r('app.float.self_comment_input_right') + }) + .width(CommonConstants.FULL_PERCENT) + .focusable(false) + } + .alignSelf(ItemAlign.Center) + .layoutWeight(1) + .borderRadius($r('app.float.self_comment_stack_radius')) + .height($r('app.float.self_comment_stack_height')) + } + .shadow({ + radius: DetailConstants.SHADOW_RADIUS, + color: $r('app.color.shadow_color'), + offsetY: DetailConstants.SHADOW_OFFSET_Y + }) + .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.self_comment_row_height') : + $r('app.float.self_comment_row_height_more')) + .width(CommonConstants.FULL_PERCENT) + .alignItems(VerticalAlign.Center) + .backgroundColor(Color.White) + .padding({ + right: $r('app.float.self_comment_row_padding_right'), + bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : + $r('app.float.self_comment_row_padding_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/SideEpisodes.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/SideEpisodes.ets new file mode 100644 index 0000000000000000000000000000000000000000..96ea6683185332ba29faa73201eacc9799528cd2 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/SideEpisodes.ets @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct SideEpisodes { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentHeightBreakpoint') currentHeightBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('isFullScreen') isFullScreen: boolean = false; + @Link isShowingSideBar: boolean; + @Link foldStatus: display.FoldStatus; + + build() { + Column() { + // Episodes sidebar. + Row() { + Blank() + SideTitleText({ content: DetailConstants.PLAYER_TEXT_LIST[0] }) + .width($r('app.float.side_title_width_1')) + .margin({ right: $r('app.float.side_title_margin') }) + SideTitleText({ content: DetailConstants.PLAYER_TEXT_LIST[1] }) + .width($r('app.float.side_title_width_2')) + .opacity(CommonConstants.TEXT_OPACITY[2]) + Blank() + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.side_row_margin_sm') : $r('app.float.side_row_margin') }) + + List({ space: CommonConstants.LIST_SPACE }) { + ForEach(DetailConstants.PLAYER_EPISODE, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize($r('app.float.title_font')) + .fontColor(index === 1 ? $r('app.color.font_selected') : Color.White) + .fontWeight(FontWeight.Normal) + + Image($r('app.media.video_playing')) + .height($r('app.float.playing_size')) + .width($r('app.float.playing_size')) + .position({ + x: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.playing_position_x_side_lg') : $r('app.float.playing_position_x_side'), + y: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.playing_position_y_side_lg') : $r('app.float.playing_position_y_side') + }) + .visibility(index === 1 ? Visibility.Visible : Visibility.None) + } + .justifyContent(FlexAlign.Center) + .borderRadius($r('app.float.episode_row_radius')) + .backgroundColor($r('app.color.episode_row_background')) + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.episode_row_width_lg') : $r('app.float.episode_row_width_other')) + .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.episode_row_height_lg') : $r('app.float.episode_row_height_other')) + } + }, (item: string, index: number) => index + JSON.stringify(item)) + } + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + .edgeEffect(EdgeEffect.None) + .scrollBar(BarState.Off) + .lanes(DetailConstants.EPISODE_LIST_LANES[1], $r('app.float.lanes_item_space')) + .padding({ + left: $r('app.float.episodes_sidebar_padding_left_right'), + right: $r('app.float.episodes_sidebar_padding_left_right'), + bottom: $r('app.float.episodes_sidebar_padding_bottom') + }) + } + .justifyContent(FlexAlign.Start) + .backgroundColor(Color.Black) + .layoutWeight(this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? 2 : 0) + .height(CommonConstants.FULL_PERCENT) + .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.side_col_width') : 0) + .visibility((this.isShowingSideBar && this.isFullScreen && (this.currentWidthBreakpoint === + BreakpointConstants.BREAKPOINT_LG || (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && + this.currentHeightBreakpoint === BreakpointConstants.BREAKPOINT_SM))) ? Visibility.Visible : Visibility.None) + } +} + +@Component +struct SideTitleText { + public content: ResourceStr = ''; + + build() { + Text(this.content) + .fontSize($r('app.float.side_text_font')) + .fontColor(Color.White) + .fontWeight(FontWeight.Normal) + .lineHeight($r('app.float.side_text_line')) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetail.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..73e5dab4c5d95e1940bbee75081edeb87ef4e584 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetail.ets @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { KeyCode } from '@kit.InputKit'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { display, window } from '@kit.ArkUI'; +import { + AvPlayerUtil, + DeviceScreen, + Logger, + WindowUtil, + BreakpointConstants, + CommonConstants, + DisplayUtil, + VideoNavPathStack +} from '@ohos/commons'; +import { SelfComment } from './SelfComment'; +import { AllComments } from './AllComments'; +import { VideoDetailView } from './VideoDetailView'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct VideoDetail { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentHeightBreakpoint') currentHeightBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('isHalfFolded') @Watch('onHalfFoldedChange') isHalfFolded: boolean = false; + @StorageLink('avplayerState') avplayerState: string = ''; + @StorageLink('isFullScreen') @Watch('onFullScreenChange') isFullScreen: boolean = false; + @Consume('pageInfo') pageInfo: VideoNavPathStack; + @State commentImgHeight: string = DetailConstants.INITIAL_COMMENT_IMAGE_HEIGHT; + @State commentImgWidth: string = DetailConstants.INITIAL_COMMENT_IMAGE_WIDTH; + @State relatedVideoHeight: number = DetailConstants.INITIAL_RELATED_VIDEO_HEIGHT; + @State videoHeight: number = DetailConstants.INITIAL_VIDEO_HEIGHT; + private avPlayerUtil?: AvPlayerUtil = AvPlayerUtil.getInstance(); + public screenHeight: number = 0; + private windowUtil?: WindowUtil = WindowUtil.getInstance(); + private mainWindow?: window.Window; + // [Start on_window_size_change] + private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { + // [StartExclude on_window_size_change] + if (this.pageInfo.getPageName() !== CommonConstants.PAGE_NAMES[1]) { + return; + } + // [EndExclude on_window_size_change] + if (((this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint !== + BreakpointConstants.BREAKPOINT_SM) || this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && + !this.isHalfFolded) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); + } + // [StartExclude on_window_size_change] + else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === + BreakpointConstants.BREAKPOINT_SM) { + if (this.isFullScreen) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); + } else { + this.windowUtil?.setMainWindowOrientation(window.Orientation.PORTRAIT); + } + } else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM && this.currentHeightBreakpoint === + BreakpointConstants.BREAKPOINT_LG) { + if (this.isFullScreen) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); + } else { + this.windowUtil?.setMainWindowOrientation(window.Orientation.PORTRAIT); + } + } + // [EndExclude on_window_size_change] + }; + // [End on_window_size_change] + private onHalfFoldedChange(): void { + if (this.isHalfFolded) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); + } else { + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === + BreakpointConstants.BREAKPOINT_MD) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); + } + } + } + // [Start on_full_screen_change] + private onFullScreenChange(): void { + if (((this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint !== + BreakpointConstants.BREAKPOINT_SM) || this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && + !this.isHalfFolded) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); + } else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM && this.currentHeightBreakpoint === + BreakpointConstants.BREAKPOINT_LG) { + if (this.isFullScreen) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); + } else { + this.windowUtil?.setMainWindowOrientation(window.Orientation.PORTRAIT); + } + } else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === + BreakpointConstants.BREAKPOINT_SM && !this.isFullScreen) { + this.windowUtil?.setMainWindowOrientation(window.Orientation.PORTRAIT); + } + if (deviceInfo.deviceType !== CommonConstants.DEVICE_TYPE) { + if (this.isFullScreen) { + this.windowUtil!.disableWindowSystemBar(); + } else { + this.windowUtil!.enableWindowSystemBar(); + } + } + } + // [End quick_start] + // [Start on_full_screen_change] + aboutToAppear() { + // [StartExclude about_to_appear] + DisplayUtil.getFoldCreaseRegion(); + this.screenHeight = DeviceScreen.getDeviceHeight(); + this.mainWindow = this.windowUtil!.getMainWindow(); + // [EndExclude about_to_appear] + this.mainWindow?.on('windowSizeChange', this.onWindowSizeChange); + if (this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM) { + this.windowUtil!.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); + } + } + // [End about_to_appear] + + async aboutToDisappear() { + this.isFullScreen = false; + this.avPlayerUtil?.offTimeUpdate(); + await this.avPlayerUtil?.release(); + + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + this.windowUtil!.setMainWindowOrientation(window.Orientation.LANDSCAPE); + } else { + this.windowUtil!.setMainWindowOrientation(window.Orientation.PORTRAIT); + } + } + + build() { + NavDestination() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ + span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[0], + lg: BreakpointConstants.GRID_COLUMN_SPANS[0] + } + }) { + // [Start video_detail] + SideBarContainer() { + Column() { + // Sidebar area. + // [StartExclude VideoDetail] + Scroll() { + AllComments({ commentImgHeight: $commentImgHeight, commentImgWidth: $commentImgWidth }) + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + } + .align(Alignment.Top) + .scrollBar(BarState.Off) + .layoutWeight(1) + .width(CommonConstants.FULL_PERCENT) + .padding({ bottom: $r('app.float.side_scroll_padding') }) + + SelfComment() + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : + Visibility.None) + // [EndExclude VideoDetail] + } + // [StartExclude VideoDetail] + .justifyContent(FlexAlign.Start) + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.White) + // [EndExclude VideoDetail] + .onAreaChange((newValue: Area) => { + if (newValue.width !== 0) { + // Handling when the width of the sidebar changes. + // [StartExclude VideoDetail] + let height: number = DetailConstants.COMMENT_IMAGE_MIN_HEIGHT_NUMBER + (Number(newValue.width) - + DetailConstants.SIDE_BAR_MIN_WIDTH_NUMBER) / + (px2vp(this.windowWidth) * DetailConstants.COMMENTS_AREA_PERCENT - + DetailConstants.SIDE_BAR_MIN_WIDTH_NUMBER) * (DetailConstants.COMMENT_IMAGE_MAX_HEIGHT_NUMBER - + DetailConstants.COMMENT_IMAGE_MIN_HEIGHT_NUMBER); + let width: number = DetailConstants.COMMENT_IMAGE_MIN_WIDTH_NUMBER + (Number(newValue.width) - + DetailConstants.SIDE_BAR_MIN_WIDTH_NUMBER) / + (px2vp(this.windowWidth) * DetailConstants.COMMENTS_AREA_PERCENT - + DetailConstants.SIDE_BAR_MIN_WIDTH_NUMBER) * (DetailConstants.COMMENT_IMAGE_MAX_WIDTH_NUMBER - + DetailConstants.COMMENT_IMAGE_MIN_WIDTH_NUMBER); + this.commentImgHeight = JSON.stringify(height); + this.commentImgWidth = JSON.stringify(width); + // [EndExclude VideoDetail] + } + }) + + Column() { + // Content area. + // [StartExclude VideoDetail] + VideoDetailView({ + screenHeight: this.screenHeight, + relatedVideoHeight: this.relatedVideoHeight, + videoHeight: this.videoHeight + }) + .layoutWeight(1) + SelfComment() + .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG || this.isFullScreen ? + Visibility.None : Visibility.Visible) + // [EndExclude VideoDetail] + } + // [StartExclude VideoDetail] + .height(CommonConstants.FULL_PERCENT) + .width(CommonConstants.FULL_PERCENT) + // [EndExclude VideoDetail] + } + .showSideBar(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && !this.isFullScreen ? true : + false) + // [StartExclude VideoDetail] + .showControlButton(false) + .autoHide(false) + .sideBarPosition(SideBarPosition.End) + // [EndExclude VideoDetail] + .sideBarWidth($r('app.float.side_bar_min_width')) + .minSideBarWidth($r('app.float.side_bar_min_width')) + .maxSideBarWidth(px2vp(this.windowWidth * DetailConstants.COMMENTS_AREA_PERCENT)) + // [End video_detail] + } + .height(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .onBreakpointChange((breakPoints) => { + if (breakPoints !== BreakpointConstants.BREAKPOINT_LG && + this.videoHeight < DetailConstants.INITIAL_VIDEO_HEIGHT) { + this.relatedVideoHeight = 0; + } else if (breakPoints === BreakpointConstants.BREAKPOINT_LG) { + this.relatedVideoHeight = DetailConstants.INITIAL_RELATED_VIDEO_HEIGHT; + } else { + Logger.info(`No specific function`); + } + }) + } + .hideTitleBar(true) + .onShown(() => { + if (this.avplayerState !== CommonConstants.AV_PLAYER_PLAYING_STATE) { + this.avPlayerUtil!.playerStateControl(); + } + if (canIUse('SystemCapability.Window.SessionManager')) { + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && display.isFoldable()) { + this.isHalfFolded = false; + } + } + }) + .onKeyEvent((event?: KeyEvent) => { + if (!event || event.type !== KeyType.Down) { + return; + } + if (event.keyCode === KeyCode.KEYCODE_SPACE) { + this.avPlayerUtil!.playerStateControl(); + } + if (event.keyCode === KeyCode.KEYCODE_ESCAPE) { + this.windowUtil!.recover(); + } + if (event.keyCode === KeyCode.KEYCODE_DPAD_RIGHT) { + this.avPlayerUtil!.fastForward(); + } + if (event.keyCode === KeyCode.KEYCODE_DPAD_LEFT) { + this.avPlayerUtil!.rewind(); + } + }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetailView.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetailView.ets new file mode 100644 index 0000000000000000000000000000000000000000..d71d4ad51f9824d3766faf5e16452102ad1e3245 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoDetailView.ets @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { BreakpointConstants, CommonConstants } from '@ohos/commons'; +import { Logger } from '@ohos/commons'; +import { RelatedList } from './RelatedList'; +import { CurrentOffsetUtil } from '../utils/CurrentOffsetUtil'; +import { DetailConstants } from '../constants/DetailConstants'; +import { VideoPlayer } from './VideoPlayer'; +import { FooterEpisodes } from './FooterEpisodes'; +import { SideEpisodes } from './SideEpisodes'; + +@Component +export struct VideoDetailView { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('creaseRegion') creaseRegion: number[] = []; + @StorageLink('isHalfFolded') isHalfFolded: boolean = false; + @StorageLink('isFullScreen') isFullScreen: boolean = false; + @Link relatedVideoHeight: number; + @Link videoHeight: number; + @State isShowingSideBar: boolean = false; + @State foldStatus: display.FoldStatus | undefined = undefined + public screenHeight: number = 0; + private scroller: Scroller = new Scroller(); + + aboutToAppear(): void { + if(canIUse('SystemCapability.Window.SessionManager')){ + this.foldStatus = display.getFoldStatus(); + } + } + + build() { + Scroll(this.scroller) { + Column() { + Row() { + Column() { + VideoPlayer({ + videoHeight: this.videoHeight, + isShowingSideBar: this.isShowingSideBar, + foldStatus: this.foldStatus + }) + + Blank() + .height(this.creaseRegion[1]) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.isHalfFolded && this.isShowingSideBar && this.isFullScreen ? Visibility.Visible : + Visibility.None) + + FooterEpisodes({ + isShowingSideBar: this.isShowingSideBar, + foldStatus: this.foldStatus + }) + } + .layoutWeight(3) + + SideEpisodes({ + isShowingSideBar: this.isShowingSideBar, + foldStatus: this.foldStatus + }) + } + .justifyContent(FlexAlign.Start) + .backgroundColor(Color.Black) + .height(this.isFullScreen ? CommonConstants.FULL_PERCENT : 'auto') + .width(CommonConstants.FULL_PERCENT) + + RelatedList({ + relatedVideoHeight: this.relatedVideoHeight, + videoHeight: this.videoHeight, + screenHeight: this.screenHeight + }) + } + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.Start) + } + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.Off) + .height(CommonConstants.FULL_PERCENT) + .onScrollFrameBegin((offset: number) => { + if (this.isFullScreen) { + return { offsetRemain: offset }; + } + if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + if ((offset > 0) && (this.videoHeight > DetailConstants.MIN_VIDEO_PERCENT)) { + // Video zoom-out logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + // Video shrinkage percentage. + let heightOffset = offsetPercent < this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT ? offsetPercent : + this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT; + this.videoHeight = this.videoHeight - heightOffset; + } else if ((offset < 0) && (this.videoHeight < DetailConstants.MAX_VIDEO_PERCENT) && + (CurrentOffsetUtil.scrollToTop(JSON.stringify(this.scroller.currentOffset())))) { + // Video magnification logic. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + let heightOffset = offsetPercent < DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight ? offsetPercent : + DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight; + this.videoHeight = this.videoHeight + heightOffset; + } else { + Logger.info(`No specific function`); + } + } else { + if ((offset > 0) && (this.videoHeight === DetailConstants.MAX_VIDEO_PERCENT) && (this.relatedVideoHeight > 0)) { + // Related list shrinking logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.TEN) / this.screenHeight; + this.relatedVideoHeight = (this.relatedVideoHeight - offsetPercent * DetailConstants.RELATED_LIST_HEIGHT) < + 0 ? 0 : (this.relatedVideoHeight - offsetPercent * DetailConstants.RELATED_LIST_HEIGHT); + } else if ((offset > 0) && (this.videoHeight > DetailConstants.MIN_VIDEO_PERCENT) && + (this.relatedVideoHeight === 0)) { + // Video zoom-out logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + // Video shrinkage percentage. + let heightOffset = offsetPercent < this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT ? offsetPercent : + this.videoHeight - DetailConstants.MIN_VIDEO_PERCENT; + this.videoHeight = this.videoHeight - heightOffset; + } else if ((this.videoHeight < DetailConstants.MAX_VIDEO_PERCENT) && (this.relatedVideoHeight === 0) + && (offset < 0) && (CurrentOffsetUtil.scrollToTop(JSON.stringify(this.scroller.currentOffset())))) { + // Video magnification logic. + let offsetPercent = (Math.abs(offset) * DetailConstants.MAX_VIDEO_PERCENT) / this.screenHeight; + let heightOffset = offsetPercent < DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight ? offsetPercent : + DetailConstants.MAX_VIDEO_PERCENT - this.videoHeight; + this.videoHeight = this.videoHeight + heightOffset; + } else if ((offset < 0) && (this.videoHeight === DetailConstants.MAX_VIDEO_PERCENT) && + (this.relatedVideoHeight >= 0)) { + // Related list enlargement logic. + // Percentage of screen height by sliding. + let offsetPercent = (Math.abs(offset) * DetailConstants.TEN) / this.screenHeight; + this.relatedVideoHeight = (this.relatedVideoHeight + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT) > + DetailConstants.RELATED_LIST_HEIGHT ? DetailConstants.RELATED_LIST_HEIGHT : (this.relatedVideoHeight + + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT); + } else { + Logger.info(`No specific function`); + } + } + // Returns the actual offset 0. + return { offsetRemain: 0 }; + }) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoPlayer.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoPlayer.ets new file mode 100644 index 0000000000000000000000000000000000000000..9850df6c1f696bb83c81f15cc0b0b92f5d3689e7 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/view/VideoPlayer.ets @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { display } from '@kit.ArkUI'; +import { deviceInfo } from '@kit.BasicServicesKit'; +import { AvPlayerUtil, BreakpointConstants, CommonConstants, VideoNavPathStack, WindowUtil } from '@ohos/commons'; +import { DetailConstants } from '../constants/DetailConstants'; + +@Component +export struct VideoPlayer { + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentHeightBreakpoint') currentHeightBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink('currentTime') currentTime: string = CommonConstants.INITIAL_TIME; + @StorageLink('totalTime') totalTime: string = CommonConstants.INITIAL_TIME; + @StorageLink('isHalfFolded') isHalfFolded: boolean = false; + @StorageLink('creaseRegion') creaseRegion: number[] = []; + @StorageLink('progress') progress: number = 0; + @StorageLink('avplayerState') avplayerState: string = ''; + @StorageLink('isFullScreen') isFullScreen: boolean = false; + @Link videoHeight: number; + @Link isShowingSideBar: boolean; + @Link foldStatus: display.FoldStatus; + @Consume('pageInfo') pageInfo: VideoNavPathStack; + private windowUtil?: WindowUtil = WindowUtil.getInstance(); + private avPlayerUtil?: AvPlayerUtil; + private xComponentController: XComponentController = new XComponentController(); + private onFoldStatusChange: Callback = (data: display.FoldStatus) => { + this.foldStatus = data; + if (canIUse('SystemCapability.Window.SessionManager')) { + if (data === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) { + let orientation: display.Orientation = display.getDefaultDisplaySync().orientation; + if (orientation === display.Orientation.LANDSCAPE || orientation === display.Orientation.LANDSCAPE_INVERTED) { + this.isHalfFolded = true; + // Full-screen playback. + if (!this.isFullScreen) { + this.isFullScreen = true; + } + } + } else { + this.isHalfFolded = false; + } + } + }; + + aboutToAppear(): void { + this.avPlayerUtil = AvPlayerUtil.getInstance(); + if (canIUse('SystemCapability.Window.SessionManager')) { + display.on('foldStatusChange', this.onFoldStatusChange); + } + } + + aboutToDisappear(): void { + if (canIUse('SystemCapability.Window.SessionManager')) { + display.off('foldStatusChange'); + } + } + + build() { + // [Start video_player] + Stack({ alignContent: this.isFullScreen ? Alignment.Center : Alignment.Bottom }) { + Flex({ + // [StartExclude video_player] + direction: FlexDirection.Column, + justifyContent: this.isHalfFolded ? FlexAlign.Start : FlexAlign.Center, + alignItems: ItemAlign.Start + // [EndExclude video_player] + }) { + Column() { + // [StartExclude video_player] + XComponent({ + id: CommonConstants.PAGE_NAMES[1], + type: XComponentType.SURFACE, + controller: this.xComponentController + }) + .onLoad(() => { + this.avPlayerUtil?.createAvPlayer(this.xComponentController.getXComponentSurfaceId()); + AppStorage.setOrCreate('detailSurfaceId', this.xComponentController.getXComponentSurfaceId()); + }) + .width(this.isFullScreen ? -1 : this.videoHeight + DetailConstants.PERCENT_SIGN) + .aspectRatio(CommonConstants.VIDEO_ASPECT_RATIO) + // [EndExclude video_player] + } + .justifyContent(FlexAlign.Center) + .height(this.isHalfFolded ? this.creaseRegion[0] : (this.isFullScreen ? CommonConstants.FULL_PERCENT : 'auto')) + .width(CommonConstants.FULL_PERCENT) + } + .width(CommonConstants.FULL_PERCENT) + .onClick(() => { + if (this.isShowingSideBar) { + this.isShowingSideBar = false; + } else { + this.avPlayerUtil?.playerStateControl(); + } + }) + .priorityGesture( + TapGesture({ count: 2 }) + .onAction((event: GestureEvent) => { + if (event && deviceInfo.deviceType === CommonConstants.DEVICE_TYPE) { + this.isFullScreen = true; + this.windowUtil!.maximize(); + } + }) + ) + // [StartExclude video_player] + Column() { + Row() { + TimeText({ time: this.currentTime }) + .margin({ + left: $r('app.float.current_time_left'), + right: $r('app.float.current_time_right') + }) + + Slider({ + min: 0, + max: CommonConstants.PROGRESS_HUNDRED, + step: 1, + value: this.progress + }) + .onChange((value: number, mode: SliderChangeMode) => { + this.avPlayerUtil?.sliderChange(value, mode); + }) + .layoutWeight(1) + .selectedColor($r('app.color.selected_color')) + + TimeText({ time: this.totalTime }) + .margin({ + left: $r('app.float.total_time_left'), + right: $r('app.float.total_time_right') + }) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.time_row_height')) + .alignItems(VerticalAlign.Center) + .visibility(this.isFullScreen ? Visibility.Visible : Visibility.None) + + Row() { + Row() { + Image(this.avplayerState === CommonConstants.AV_PLAYER_PLAYING_STATE ? $r('app.media.ic_public_pause') + : $r('app.media.ic_public_play')) + .height($r('app.float.icon_size')) + .width($r('app.float.icon_size')) + .margin({ left: $r('app.float.icon_margin') }) + .onClick(() => { + this.avPlayerUtil?.playerStateControl(); + }) + ImgIcon({ img: $r('app.media.ic_public_play_next') }) + ImgIcon({ img: $r('app.media.ic_public_view_list_white') }) + } + .margin({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '0' : $r('app.float.icon_row_top'), + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.icon_row_bottom_sm') : $r('app.float.icon_row_bottom') + }) + + Blank() + + Row() { + TextButton({ content: DetailConstants.PLAYER_TEXT_LIST[0] }) + .onClick(() => { + this.isShowingSideBar = !this.isShowingSideBar; + }) + TextButton({ content: DetailConstants.PLAYER_TEXT_LIST[2] }) + TextButton({ content: DetailConstants.PLAYER_TEXT_LIST[3] }) + } + .margin({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.button_row_top_sm') : + $r('app.float.button_row_top'), + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.button_row_bottom_sm') : $r('app.float.button_row_bottom') + }) + } + .height($r('app.float.icon_button_row_height')) + .width(CommonConstants.FULL_PERCENT) + .visibility(this.isFullScreen ? Visibility.Visible : Visibility.None) + } + .height(this.isFullScreen ? CommonConstants.FULL_PERCENT : 'auto') + .width(CommonConstants.FULL_PERCENT) + .justifyContent(FlexAlign.End) + .visibility(this.isFullScreen && !this.isShowingSideBar ? Visibility.Visible : Visibility.None) + .priorityGesture( + TapGesture({ count: 2 }) + .onAction((event: GestureEvent) => { + if (event && deviceInfo.deviceType === CommonConstants.DEVICE_TYPE) { + this.windowUtil!.maximize(); + this.windowUtil!.recover(); + } + }) + ) + + Row() { + TimeText({ time: this.currentTime }) + .margin({ + left: $r('app.float.current_time_text_left'), + right: $r('app.float.current_time_text_right') + }) + + Slider({ + min: 0, + max: CommonConstants.PROGRESS_HUNDRED, + step: 1, + value: this.progress + }) + .onChange((value: number, mode: SliderChangeMode) => { + this.avPlayerUtil?.sliderChange(value, mode); + }) + .layoutWeight(1) + .selectedColor($r('app.color.episodes_font')) + + TimeText({ time: this.totalTime }) + .margin({ + left: $r('app.float.total_time_text_left'), + right: $r('app.float.total_time_text_right') + }) + + Image($r('app.media.ic_public_enlarge')) + .height($r('app.float.enlarge_size')) + .width($r('app.float.enlarge_size')) + .margin({ right: $r('app.float.enlarge_margin') }) + .fillColor(Color.White) + .onClick(() => { + this.isFullScreen = true; + }) + + Image($r('app.media.ic_public_fullscreen')) + .height($r('app.float.enlarge_size')) + .width($r('app.float.enlarge_size')) + .margin({ right: $r('app.float.enlarge_margin') }) + .fillColor(Color.White) + .visibility(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? Visibility.Visible : Visibility.None) + .onClick(() => { + this.isFullScreen = true; + this.windowUtil!.maximize(); + }) + } + .width(CommonConstants.FULL_PERCENT) + .height($r('app.float.time_row_height')) + .alignItems(VerticalAlign.Center) + .visibility(!this.isFullScreen ? Visibility.Visible : Visibility.None) + // [EndExclude video_player] + Image($r('app.media.ic_public_back')) + .height($r('app.float.back_size')) + .width($r('app.float.back_size')) + .position({ + x: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.back_position_x') : + $r('app.float.back_position_x_lg'), + y: $r('app.float.back_position_y') + }) + .fillColor(Color.White) + .onClick(() => { + if (this.isHalfFolded) { + this.isHalfFolded = false; + } + if (this.isFullScreen) { + this.isFullScreen = false; + } else { + this.pageInfo.setPageName('home'); + this.pageInfo.pop(); + } + }) + } + // [End video_player] + .height('auto') + .layoutWeight(this.isFullScreen ? 1 : 0) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor(Color.Black) + .focusable(false) + } +} + +@Component +struct ImgIcon { + public img?: Resource; + + build() { + Image(this.img ? this.img : '') + .height($r('app.float.icon_size')) + .width($r('app.float.icon_size')) + .margin({ left: $r('app.float.icon_margin') }) + } +} + +@Component +struct TextButton { + public content: ResourceStr = ''; + + build() { + Text(this.content) + .fontSize($r('app.float.button_text_font')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .margin({ right: $r('app.float.button_text_margin') }) + } +} + +@Component +struct TimeText { + @Link time: string; + + build() { + Text(this.time) + .fontSize($r('app.float.time_font')) + .fontColor(Color.White) + .lineHeight($r('app.float.time_text_line')) + .width($r('app.float.time_text_width')) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e24db27dbb17f3ea425892ec053d685a501fbed --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DetailConstants } from '../constants/DetailConstants'; + +export class RelatedVideoViewModel { + private relatedVideoList: RelatedVideo[] = []; + private peripheralVideoList: RelatedVideo[] = []; + + constructor() { + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[0], + $r('app.media.related_video_1'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[1], + $r('app.media.related_video_2'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[2], + $r('app.media.related_video_3'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[3], + $r('app.media.related_video_4'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[4], + $r('app.media.related_video_5'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[5], + $r('app.media.related_video_6'))); + this.relatedVideoList.push(new RelatedVideo(DetailConstants.RELATED_VIDEO_TITLES[6], + $r('app.media.related_video_7'))); + this.peripheralVideoList.push(new RelatedVideo(DetailConstants.PERIPHERAL_VIDEO_TITLE[0], + $r('app.media.peripheral_video_1'))); + this.peripheralVideoList.push(new RelatedVideo(DetailConstants.PERIPHERAL_VIDEO_TITLE[1], + $r('app.media.peripheral_video_2'))); + this.peripheralVideoList.push(new RelatedVideo(DetailConstants.PERIPHERAL_VIDEO_TITLE[2], + $r('app.media.peripheral_video_3'))); + this.peripheralVideoList.push(new RelatedVideo(DetailConstants.PERIPHERAL_VIDEO_TITLE[3], + $r('app.media.peripheral_video_4'))); + this.peripheralVideoList.push(new RelatedVideo(DetailConstants.PERIPHERAL_VIDEO_TITLE[4], + $r('app.media.peripheral_video_5'))); + } + + getRelatedVideoList(): RelatedVideo[] { + return this.relatedVideoList; + } + + getPeripheralVideoList(): RelatedVideo[] { + return this.peripheralVideoList; + } +} + +export class RelatedVideo { + /** + * Name of the related video. + */ + private name: ResourceStr; + + /** + * Image src of related video. + */ + private imageSrc: Resource; + + constructor(name: ResourceStr, imageSrc: Resource) { + this.name = name; + this.imageSrc = imageSrc; + } + + public getName(): ResourceStr { + return this.name; + } + + public getImageSrc(): Resource { + return this.imageSrc; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets b/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..f75dceb09e11b5de6ae22a4a75b3ec1aaef9a0d0 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DetailConstants } from '../constants/DetailConstants'; + +export class UserViewModel { + private userList: UserInfo[] = []; + + constructor() { + this.userList.push(new UserInfo(DetailConstants.USER_INFO_NAMES[0], $r('app.media.user_profile_2'), + DetailConstants.USER_INFO_COMMENTS[0], undefined, DetailConstants.USER_INFO_DATE)); + this.userList.push(new UserInfo(DetailConstants.USER_INFO_NAMES[1], $r('app.media.user_profile_3'), + DetailConstants.USER_INFO_COMMENTS[1], $r("app.media.comment_2"), DetailConstants.USER_INFO_DATE)); + this.userList.push(new UserInfo(DetailConstants.USER_INFO_NAMES[2], $r('app.media.user_profile_4'), + DetailConstants.USER_INFO_COMMENTS[2], $r('app.media.comment_3'), DetailConstants.USER_INFO_DATE)); + } + + getRelatedVideoList(): UserInfo[] { + return this.userList; + } + + getSelfInfo(): UserInfo { + return new UserInfo('', $r('app.media.user_profile_1'), '', undefined, ''); + } +} + +export class UserInfo { + /** + * Name of the user. + */ + private name: string; + + /** + * Image src of user. + */ + private imageSrc: Resource; + + /** + * Comment of user. + */ + private comment: ResourceStr; + + /** + * Image src of the comment. + */ + private commentImageSrc: Resource | undefined; + + /** + * Time of the comment. + */ + private time: ResourceStr; + + constructor(name: string, imageSrc: Resource, comment: ResourceStr, commentImageSrc: Resource | undefined, time: ResourceStr) { + this.name = name; + this.imageSrc = imageSrc; + this.comment = comment; + this.commentImageSrc = commentImageSrc; + this.time = time; + } + + public getName(): string { + return this.name; + } + + public getImageSrc(): Resource { + return this.imageSrc; + } + + public getComment(): ResourceStr { + return this.comment; + } + + public getCommentImageSrc(): Resource | undefined { + return this.commentImageSrc; + } + + public getTime(): ResourceStr { + return this.time; + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/module.json5 b/MultiVideoApplication/features/videoDetail/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..77b02323e24845455f55f7d74f86aff6ac37e4ed --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "videoDetail", + "type": "har", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ] + } +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/color.json b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..ab978fc369b3773bbacdc41391fcaa76fadcdb01 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/color.json @@ -0,0 +1,28 @@ +{ + "color": [ + { + "name": "episodes_font", + "value": "#ED6F21" + }, + { + "name": "episodes_background", + "value": "#0D000000" + }, + { + "name": "shadow_color", + "value": "#2600001E" + }, + { + "name": "selected_color", + "value": "#ED6F21" + }, + { + "name": "episode_row_background", + "value": "#33FFFFFF" + }, + { + "name": "font_selected", + "value": "#ED6F21" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/float.json b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..9f11426850dd10679c67b0f8767fdc929d30e625 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/float.json @@ -0,0 +1,604 @@ +{ + "float": [ + { + "name": "side_scroll_padding", + "value": "12vp" + }, + { + "name": "side_bar_min_width", + "value": "320vp" + }, + { + "name": "all_comments_title_text_font", + "value": "16fp" + }, + { + "name": "all_comments_title_text_line", + "value": "22vp" + }, + { + "name": "all_comments_title_row_padding", + "value": "24vp" + }, + { + "name": "all_comments_title_row_height", + "value": "48vp" + }, + { + "name": "all_comments_profile_size", + "value": "36vp" + }, + { + "name": "all_comments_profile_margin", + "value": "16vp" + }, + { + "name": "all_comments_title_margin", + "value": "10vp" + }, + { + "name": "all_comments_comment_left", + "value": "52vp" + }, + { + "name": "all_comments_comment_font", + "value": "14fp" + }, + { + "name": "all_comments_comment_text_line", + "value": "28vp" + }, + { + "name": "all_comments_comment_row_top", + "value": "4vp" + }, + { + "name": "all_comments_img_radius", + "value": "8vp" + }, + { + "name": "all_comments_img_row_padding", + "value": "52vp" + }, + { + "name": "all_comments_img_row_margin", + "value": "12vp" + }, + { + "name": "all_comments_comment_time_font", + "value": "12fp" + }, + { + "name": "all_comments_comment_time_line", + "value": "18vp" + }, + { + "name": "all_comments_comment_time_margin", + "value": "52vp" + }, + { + "name": "all_comments_icon_size", + "value": "16vp" + }, + { + "name": "all_comments_icon_margin", + "value": "24vp" + }, + { + "name": "all_comments_icon_row_top", + "value": "14vp" + }, + { + "name": "all_comments_divider_margin", + "value": "12vp" + }, + { + "name": "all_comments_divider_height", + "value": "1vp" + }, + { + "name": "all_comments_comment_col_padding", + "value": "24vp" + }, + { + "name": "sub_title_font", + "value": "16fp" + }, + { + "name": "sub_title_text_line", + "value": "22vp" + }, + { + "name": "sub_title_font_more", + "value": "14fp" + }, + { + "name": "sub_title_text_line_more", + "value": "19vp" + }, + { + "name": "arrow_img_size", + "value": "24vp" + }, + { + "name": "sub_title_row_padding", + "value": "24vp" + }, + { + "name": "sub_title_row_height_detail", + "value": "48vp" + }, + { + "name": "related_img_height", + "value": "76vp" + }, + { + "name": "related_img_width", + "value": "135vp" + }, + { + "name": "related_img_radius", + "value": "8vp" + }, + { + "name": "related_img_margin", + "value": "8vp" + }, + { + "name": "related_name_font", + "value": "14fp" + }, + { + "name": "related_name_line", + "value": "19vp" + }, + { + "name": "related_list_top", + "value": "8vp" + }, + { + "name": "related_list_bottom", + "value": "10vp" + }, + { + "name": "related_row_left", + "value": "24vp" + }, + { + "name": "related_row_bottom", + "value": "10vp" + }, + { + "name": "related_row_height", + "value": "121vp" + }, + { + "name": "introduction_content_font", + "value": "14fp" + }, + { + "name": "introduction_content_line", + "value": "28vp" + }, + { + "name": "introduction_icon_size", + "value": "24vp" + }, + { + "name": "introduction_row_padding", + "value": "12vp" + }, + { + "name": "is_playing_icon_size", + "value": "10vp" + }, + { + "name": "is_playing_icon_x", + "value": "8vp" + }, + { + "name": "is_playing_icon_y", + "value": "36vp" + }, + { + "name": "episodes_text_font", + "value": "18fp" + }, + { + "name": "episodes_text_height", + "value": "24vp" + }, + { + "name": "episodes_list_height", + "value": "54vp" + }, + { + "name": "episodes_list_width", + "value": "68vp" + }, + { + "name": "episodes_list_radius", + "value": "8vp" + }, + { + "name": "episodes_list_margin", + "value": "12vp" + }, + { + "name": "peripheral_img_height", + "value": "230vp" + }, + { + "name": "peripheral_img_width", + "value": "164vp" + }, + { + "name": "peripheral_img_margin", + "value": "4vp" + }, + { + "name": "peripheral_img_radius", + "value": "16vp" + }, + { + "name": "peripheral_name_font", + "value": "14fp" + }, + { + "name": "peripheral_name_line", + "value": "19vp" + }, + { + "name": "peripheral_list_margin", + "value": "12vp" + }, + { + "name": "self_comment_profile_size", + "value": "36vp" + }, + { + "name": "self_comment_profile_radius", + "value": "18vp" + }, + { + "name": "self_comment_profile_left", + "value": "24vp" + }, + { + "name": "self_comment_profile_right", + "value": "12vp" + }, + { + "name": "self_comment_input_font", + "value": "16fp" + }, + { + "name": "self_comment_input_height", + "value": "40vp" + }, + { + "name": "self_comment_input_left", + "value": "36vp" + }, + { + "name": "self_comment_input_right", + "value": "48vp" + }, + { + "name": "self_comment_comment_size", + "value": "16vp" + }, + { + "name": "self_comment_comment_margin", + "value": "12vp" + }, + { + "name": "self_comment_comment_right", + "value": "8vp" + }, + { + "name": "self_comment_emoji_size", + "value": "24vp" + }, + { + "name": "self_comment_emoji_margin", + "value": "16vp" + }, + { + "name": "self_comment_stack_radius", + "value": "20vp" + }, + { + "name": "self_comment_stack_height", + "value": "40vp" + }, + { + "name": "self_comment_row_height", + "value": "80vp" + }, + { + "name": "self_comment_row_height_more", + "value": "100vp" + }, + { + "name": "self_comment_row_padding_right", + "value": "24vp" + }, + { + "name": "self_comment_row_padding_bottom", + "value": "20vp" + }, + { + "name": "time_font", + "value": "9fp" + }, + { + "name": "time_text_line", + "value": "12vp" + }, + { + "name": "time_text_width", + "value": "38vp" + }, + { + "name": "current_time_text_left", + "value": "24vp" + }, + { + "name": "current_time_text_right", + "value": "2vp" + }, + { + "name": "total_time_text_left", + "value": "2vp" + }, + { + "name": "total_time_text_right", + "value": "8vp" + }, + { + "name": "enlarge_size", + "value": "24vp" + }, + { + "name": "enlarge_margin", + "value": "24vp" + }, + { + "name": "time_row_height", + "value": "40vp" + }, + { + "name": "back_size", + "value": "24vp" + }, + { + "name": "back_position_x", + "value": "24vp" + }, + { + "name": "back_position_x_lg", + "value": "32vp" + }, + { + "name": "back_position_y", + "value": "36vp" + }, + { + "name": "video_col_padding", + "value": "10vp" + }, + { + "name": "current_time_left", + "value": "36vp" + }, + { + "name": "current_time_right", + "value": "2vp" + }, + { + "name": "total_time_left", + "value": "2vp" + }, + { + "name": "total_time_right", + "value": "36vp" + }, + { + "name": "icon_size", + "value": "24vp" + }, + { + "name": "icon_margin", + "value": "24vp" + }, + { + "name": "icon_row_top", + "value": "14vp" + }, + { + "name": "icon_row_bottom_sm", + "value": "15vp" + }, + { + "name": "icon_row_bottom", + "value": "24vp" + }, + { + "name": "button_text_font", + "value": "12fp" + }, + { + "name": "button_text_margin", + "value": "24vp" + }, + { + "name": "button_row_top_sm", + "value": "4vp" + }, + { + "name": "button_row_top", + "value": "16vp" + }, + { + "name": "button_row_bottom_sm", + "value": "19vp" + }, + { + "name": "button_row_bottom", + "value": "28vp" + }, + { + "name": "icon_button_row_height", + "value": "60vp" + }, + { + "name": "title_selected_font", + "value": "24fp" + }, + { + "name": "title_selected_line", + "value": "33vp" + }, + { + "name": "title_selected_width", + "value": "48vp" + }, + { + "name": "title_selected_margin", + "value": "24vp" + }, + { + "name": "title_font", + "value": "18fp" + }, + { + "name": "title_line", + "value": "25vp" + }, + { + "name": "title_width", + "value": "58vp" + }, + { + "name": "title_row_top", + "value": "25vp" + }, + { + "name": "title_row_bottom", + "value": "12vp" + }, + { + "name": "title_row_height", + "value": "56vp" + }, + { + "name": "playing_size", + "value": "10vp" + }, + { + "name": "playing_position_x", + "value": "8vp" + }, + { + "name": "playing_position_y", + "value": "36vp" + }, + { + "name": "episode_row_radius", + "value": "8vp" + }, + { + "name": "episode_row_height", + "value": "54vp" + }, + { + "name": "episode_list_bottom", + "value": "12vp" + }, + { + "name": "episode_list_lanes_space", + "value": "12vp" + }, + { + "name": "episode_col_padding", + "value": "24vp" + }, + { + "name": "side_title_width_1", + "value": "65vp" + }, + { + "name": "side_title_margin", + "value": "36vp" + }, + { + "name": "side_title_width_2", + "value": "56vp" + }, + { + "name": "side_row_margin_sm", + "value": "8vp" + }, + { + "name": "side_row_margin", + "value": "12vp" + }, + { + "name": "playing_position_x_side_lg", + "value": "8vp" + }, + { + "name": "playing_position_x_side", + "value": "6vp" + }, + { + "name": "playing_position_y_side_lg", + "value": "36vp" + }, + { + "name": "playing_position_y_side", + "value": "28vp" + }, + { + "name": "episode_row_width_lg", + "value": "69vp" + }, + { + "name": "episode_row_width_other", + "value": "55vp" + }, + { + "name": "episode_row_height_lg", + "value": "54vp" + }, + { + "name": "episode_row_height_other", + "value": "44vp" + }, + { + "name": "lanes_item_space", + "value": "12vp" + }, + { + "name": "episodes_sidebar_padding_bottom", + "value": "12vp" + }, + { + "name": "episodes_sidebar_padding_left_right", + "value": "24vp" + }, + { + "name": "side_col_width", + "value": "360vp" + }, + { + "name": "side_text_font", + "value": "16fp" + }, + { + "name": "side_text_line", + "value": "32vp" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/string.json b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4c8992be261acaf1a4746a9af908ade8dee5ddee --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/element/string.json @@ -0,0 +1,80 @@ +{ + "string": [ + { + "name": "comments", + "value": "全部评论" + }, + { + "name": "related", + "value": "相关列表" + }, + { + "name": "more", + "value": "更多" + }, + { + "name": "introduction", + "value": "视频简介" + }, + { + "name": "anthology", + "value": "选集" + }, + { + "name": "Peripheral", + "value": "周边视频" + }, + { + "name": "product", + "value": "北京时间3月23日,华为春季旗舰新品发布会,我们不见不散。" + }, + { + "name": "play", + "value": "23.4万次播放··华为终端·华为资讯·2023·中国大陆" + }, + { + "name": "released", + "value": "Matebook系列新" + }, + { + "name": "series", + "value": "HUAWEI P60 系列发布" + }, + { + "name": "feel", + "value": "感觉很不错啊,下一款准备入手Mate X3了,很喜欢折叠屏的分屏功能,终于可以一边聊天一边看短视频了!" + }, + { + "name": "love", + "value": "好喜欢这张图,很惊艳!!!竟然是手机拍出来的,太给力了!" + }, + { + "name": "design", + "value": "这个背面真的很有设计感,珠光贝母,种草了种草了" + }, + { + "name": "July", + "value": "7月27日" + }, + { + "name": "comment", + "value": "评论..." + }, + { + "name": "selections", + "value": "选集" + }, + { + "name": "just", + "value": "只看TA" + }, + { + "name": "super", + "value": "超清" + }, + { + "name": "speed", + "value": "超清" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_2.jpg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..93b3910bd6a7a550236334c9b0070869fe9bc9d8 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_2.jpg differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_3.jpg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3fb7f979741586252fbe1a45e92a938ecc308b43 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/comment_3.jpg differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_arrow_right.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..5283fd327effeee1bd23d4543e865a9cee4bfff6 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,15 @@ + + + + Public/ic_public_arrow_right + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_back.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comment.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comment.png new file mode 100644 index 0000000000000000000000000000000000000000..b2baa12a12db794024a5f131244a816023fbbafb Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comment.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comments.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_download.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_download.svg new file mode 100644 index 0000000000000000000000000000000000000000..7d6701dd5962955deffe7d68424fe31e9b09c5a5 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_download.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_download + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_emoji.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_emoji.svg new file mode 100644 index 0000000000000000000000000000000000000000..427ec26a06f119832bcf3286893917cff86ce240 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_emoji.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_emoji + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_enlarge.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_enlarge.svg new file mode 100644 index 0000000000000000000000000000000000000000..252b8fe5c6424f8d5f2eefaee0f4e410e771235e --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_enlarge.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_enlarge + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_favor.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_favor.svg new file mode 100644 index 0000000000000000000000000000000000000000..6ed99945bb665979fb509f76d42aa8244eec279f --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_favor.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_fullscreen.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_fullscreen.svg new file mode 100644 index 0000000000000000000000000000000000000000..f9af64b3ec38ffe6b11d9bc34be63f1abf448c79 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_fullscreen.svg @@ -0,0 +1,16 @@ + + + Created with Pixso. + + + + + + + + + + + + + diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_pause.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_pause.svg new file mode 100644 index 0000000000000000000000000000000000000000..63acc5a5049016f750467432ba836fbfc4d49508 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_pause.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_pause + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play.svg new file mode 100644 index 0000000000000000000000000000000000000000..73dc17cf5f245175a9c857e97f163115116a84d5 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_play + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play_next.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play_next.svg new file mode 100644 index 0000000000000000000000000000000000000000..426048890677460f4c2b630429b25cc20d99827b --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_play_next.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_play_next + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_share.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..516c03c260f5341c1a969a769e9b19648927cf6d --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_thumb_sup.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_thumb_sup.svg new file mode 100644 index 0000000000000000000000000000000000000000..b8238cc4486902c98eadd660f45a092e641865e7 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_thumb_sup.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_thumbsup + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_view_list_white.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_view_list_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..44cd4f803e3ae8bc598046e6d42a8db8fff39c5b --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/ic_public_view_list_white.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_view_list_filled + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_1.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..28e7f5ee960817f36460e3eba6f9dc67c197f54b Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_1.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_2.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a610c54fea006cac3603ae137a9030b5818c07ad Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_2.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_3.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..d3c32b0efd898aeef11e64ce290c22eb9f693cf7 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_3.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_4.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..7e259fe31e462502e229354a3b029e2d9d02d0a1 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_4.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_5.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_5.png new file mode 100644 index 0000000000000000000000000000000000000000..6868a2e576e1b56b719310e9c71ec902db78e10d Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/peripheral_video_5.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_1.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_1.png new file mode 100644 index 0000000000000000000000000000000000000000..dcd5a0d6ceaab20bdc056806aa0cc3727cac996a Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_1.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_10.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_10.png new file mode 100644 index 0000000000000000000000000000000000000000..c46615e7928045b7a61754bb54efff697839c073 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_10.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_11.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_11.png new file mode 100644 index 0000000000000000000000000000000000000000..7ddef693e2d111a9c62fe9ad4bf954aef346bd42 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_11.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_12.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_12.png new file mode 100644 index 0000000000000000000000000000000000000000..d8e2da1fd295d0a00435ba694cf8499287c63f4d Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_12.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_2.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ea8e528ddb038dfb1ca676d81303d237f91b10ea Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_2.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_3.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_3.png new file mode 100644 index 0000000000000000000000000000000000000000..3ebbd5702543bee18227a00a19fa4d919ccc19d8 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_3.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_4.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_4.png new file mode 100644 index 0000000000000000000000000000000000000000..4ed9964dcfa80b789bd6a08f00346238f6b172f0 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_4.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_5.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_5.png new file mode 100644 index 0000000000000000000000000000000000000000..109257fb85bf9eea325deb8c3781ea8ae07459a0 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_5.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_6.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_6.png new file mode 100644 index 0000000000000000000000000000000000000000..327723c32dfe2d674e8057c29d8dc98d21a27b80 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_6.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_7.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_7.png new file mode 100644 index 0000000000000000000000000000000000000000..844a84610d789246fc2fc9f15e9a4e888ea115ba Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_7.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_8.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_8.png new file mode 100644 index 0000000000000000000000000000000000000000..6e2147c44685db28a0d975f78228c617543e224d Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_8.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_9.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_9.png new file mode 100644 index 0000000000000000000000000000000000000000..5463a06aa8cf00e8eded9aa0012c4bfe10adf105 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/related_video_9.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_1.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_1.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad5fc2f0e31a26edd83223ceefa83d7cabdaf96 Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_1.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_2.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ad1cfe89abe7d00f3f27d29d12a53a2caba1c2ea Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_2.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_3.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_3.png new file mode 100644 index 0000000000000000000000000000000000000000..021b62ba16e1a0b9ab729fe33cd6bad1de8c438f Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_3.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_4.png b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_4.png new file mode 100644 index 0000000000000000000000000000000000000000..d4efeec7ddba67910883e49a950c1a846427beac Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/user_profile_4.png differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/video_playing.svg b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/video_playing.svg new file mode 100644 index 0000000000000000000000000000000000000000..0f00e3f55d20bf92ffb203ba13f29058e2d9396d --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/base/media/video_playing.svg @@ -0,0 +1,13 @@ + + + 形状结合 + + + + + + + + + + \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/en_US/element/string.json b/MultiVideoApplication/features/videoDetail/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c4bfaab927bcd453df30cbef888726e5c697d97e --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/en_US/element/string.json @@ -0,0 +1,80 @@ +{ + "string": [ + { + "name": "comments", + "value": "All comments" + }, + { + "name": "related", + "value": "Related list" + }, + { + "name": "more", + "value": "more" + }, + { + "name": "introduction", + "value": "Video introduction" + }, + { + "name": "anthology", + "value": "anthology" + }, + { + "name": "Peripheral", + "value": "Peripheral video" + }, + { + "name": "product", + "value": "On March 23, Beijing time, Huawei's spring flagship new product conference, we will see each other." + }, + { + "name": "play", + "value": "234,000 plays··Huawei terminal·Huawei Information·2023·Chinese mainland" + }, + { + "name": "released", + "value": "New to the Matebook series" + }, + { + "name": "series", + "value": "HUAWEI P60 series released" + }, + { + "name": "feel", + "value": "Feel very good ah, the next ready to start Mate X3, like the folding screen split screen function, finally can chat while watching short videos!" + }, + { + "name": "love", + "value": "Love this picture, it's amazing!! It was taken by a mobile phone. Great!" + }, + { + "name": "design", + "value": "This back is really designed, pearl fritillary, planted grass." + }, + { + "name": "July", + "value": "The 27th of July" + }, + { + "name": "comment", + "value": "comment..." + }, + { + "name": "selections", + "value": "select" + }, + { + "name": "just", + "value": "look it" + }, + { + "name": "super", + "value": "super" + }, + { + "name": "speed", + "value": "speed" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/rawfile/product.mp4 b/MultiVideoApplication/features/videoDetail/src/main/resources/rawfile/product.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..77a3449e18dfd4c0fe400e92721d79e09f2b34fc Binary files /dev/null and b/MultiVideoApplication/features/videoDetail/src/main/resources/rawfile/product.mp4 differ diff --git a/MultiVideoApplication/features/videoDetail/src/main/resources/zh_CN/element/string.json b/MultiVideoApplication/features/videoDetail/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9ad5b2e94dfbecd69aaaacb3646341132b5db4e5 --- /dev/null +++ b/MultiVideoApplication/features/videoDetail/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,80 @@ +{ + "string": [ + { + "name": "comments", + "value": "全部评论" + }, + { + "name": "related", + "value": "相关列表" + }, + { + "name": "more", + "value": "更多" + }, + { + "name": "introduction", + "value": "视频简介" + }, + { + "name": "anthology", + "value": "选集" + }, + { + "name": "Peripheral", + "value": "周边视频" + }, + { + "name": "product", + "value": "北京时间3月23日,华为春季旗舰新品发布会,我们不见不散。" + }, + { + "name": "play", + "value": "23.4万次播放··华为终端·华为资讯·2023·中国大陆" + }, + { + "name": "released", + "value": "Matebook系列新" + }, + { + "name": "series", + "value": "HUAWEI P60 系列发布" + }, + { + "name": "feel", + "value": "感觉很不错啊,下一款准备入手Mate X3了,很喜欢折叠屏的分屏功能,终于可以一边聊天一边看短视频了!" + }, + { + "name": "love", + "value": "好喜欢这张图,很惊艳!!!竟然是手机拍出来的,太给力了!" + }, + { + "name": "design", + "value": "这个背面真的很有设计感,珠光贝母,种草了种草了" + }, + { + "name": "July", + "value": "7月27日" + }, + { + "name": "comment", + "value": "评论..." + }, + { + "name": "selections", + "value": "选集" + }, + { + "name": "just", + "value": "只看TA" + }, + { + "name": "super", + "value": "超清" + }, + { + "name": "speed", + "value": "倍速" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/hvigor/hvigor-config.json5 b/MultiVideoApplication/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..eb31f8301a08fedbf8ca8dd0c17b84a8347d8220 --- /dev/null +++ b/MultiVideoApplication/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 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. + */ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/MultiVideoApplication/oh-package.json5 b/MultiVideoApplication/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1fdec2e1347c733c15032bfe9bbaa9156f2c03e3 --- /dev/null +++ b/MultiVideoApplication/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + }, + "author": "", + "name": "multivideoapplication", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/build-profile.json5 b/MultiVideoApplication/products/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3167e54d1ff3a0aaa0cdcf4319789de8e3f3c350 --- /dev/null +++ b/MultiVideoApplication/products/phone/build-profile.json5 @@ -0,0 +1,10 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/hvigorfile.ts b/MultiVideoApplication/products/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/MultiVideoApplication/products/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/MultiVideoApplication/products/phone/oh-package.json5 b/MultiVideoApplication/products/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9981d612d2a68c1f4edd3375ccbae53f71bd7421 --- /dev/null +++ b/MultiVideoApplication/products/phone/oh-package.json5 @@ -0,0 +1,15 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/videoDetail": "file:../../features/videoDetail", + "@ohos/home": "file:../../features/home" + } +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/ets/entryability/EntryAbility.ets b/MultiVideoApplication/products/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cfea5175347ddc0fc175a732025bad35d188e8c --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { window } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { WindowUtil } from '@ohos/commons'; + +export default class EntryAbility extends UIAbility { + // [Start EntryAbility] + private windowObj?: window.Window; + private windowUtil?: WindowUtil = WindowUtil.getInstance(); + private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { + this.windowUtil!.updateHeightBp(); + this.windowUtil!.updateWidthBp(); + AppStorage.setOrCreate('windowWidth', windowSize.width); + }; + // [StartExclude EntryAbility] + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + // [EndExclude EntryAbility] + onWindowStageCreate(windowStage: window.WindowStage) { + // [StartExclude EntryAbility] + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + // [EndExclude EntryAbility] + this.windowUtil!.setWindowStage(windowStage); + windowStage.getMainWindow().then((data: window.Window) => { + this.windowObj = data; + this.windowUtil!.updateWidthBp(); + this.windowUtil!.updateHeightBp(); + AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', this.onWindowSizeChange); + }); + // [StartExclude EntryAbility] + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + // [EndExclude EntryAbility] + } + // [End EntryAbility] + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/ets/pages/Index.ets b/MultiVideoApplication/products/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4bf30d5a59b940b86c71f9acda2c74ee1afb5909 --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Home } from '@ohos/home'; +import { CommonConstants, VideoNavPathStack, WindowUtil } from '@ohos/commons'; +import { VideoDetail } from '@ohos/videoDetail/src/main/ets/view/VideoDetail'; + +@Entry +@Component +struct Index { + @Provide('pageInfo') pageInfo: VideoNavPathStack = new VideoNavPathStack(); + + aboutToDisappear(): void { + let windowUtil: WindowUtil | undefined = WindowUtil.getInstance(); + windowUtil!.offWindowSizeChange(); + } + + @Builder + PageMap(name: string) { + if (name === CommonConstants.PAGE_NAMES[1]) { + VideoDetail() + } + } + + build() { + Navigation(this.pageInfo) { + Home() + } + .mode(NavigationMode.Stack) + .navDestination(this.PageMap) + .hideToolBar(true) + .hideTitleBar(true) + .hideBackButton(true) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + } +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/module.json5 b/MultiVideoApplication/products/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..761638d999d537f3bcf9267851cee8568ae86eab --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/module.json5 @@ -0,0 +1,41 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "minWindowWidth": 331, + "minWindowHeight": 600, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/element/color.json b/MultiVideoApplication/products/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/element/string.json b/MultiVideoApplication/products/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..552fb2598352eb6059c86e3409f15e786f551e6d --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiVideoApplication" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/media/background.png b/MultiVideoApplication/products/phone/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/MultiVideoApplication/products/phone/src/main/resources/base/media/background.png differ diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/media/foreground.png b/MultiVideoApplication/products/phone/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/MultiVideoApplication/products/phone/src/main/resources/base/media/foreground.png differ diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/media/layered_image.json b/MultiVideoApplication/products/phone/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/media/startIcon.png b/MultiVideoApplication/products/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/MultiVideoApplication/products/phone/src/main/resources/base/media/startIcon.png differ diff --git a/MultiVideoApplication/products/phone/src/main/resources/base/profile/main_pages.json b/MultiVideoApplication/products/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiVideoApplication/products/phone/src/main/resources/en_US/element/string.json b/MultiVideoApplication/products/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..552fb2598352eb6059c86e3409f15e786f551e6d --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiVideoApplication" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/products/phone/src/main/resources/zh_CN/element/string.json b/MultiVideoApplication/products/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..af223d6ceb4c14e29dbd4329738713f2011b2e37 --- /dev/null +++ b/MultiVideoApplication/products/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "一多开发实例-视频" + } + ] +} \ No newline at end of file diff --git a/MultiVideoApplication/screenshots/device/foldable.png b/MultiVideoApplication/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..3771c893d5cfa6c4702978d1d78c737533f8700f Binary files /dev/null and b/MultiVideoApplication/screenshots/device/foldable.png differ diff --git a/MultiVideoApplication/screenshots/device/foldable_EN.jpg b/MultiVideoApplication/screenshots/device/foldable_EN.jpg new file mode 100644 index 0000000000000000000000000000000000000000..787eddd04ca34d6b345ac6b1de6a787e28c1e69e Binary files /dev/null and b/MultiVideoApplication/screenshots/device/foldable_EN.jpg differ diff --git a/MultiVideoApplication/screenshots/device/phone.png b/MultiVideoApplication/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..f7d3a11914adedd6f190f196211af9a6146d4c87 Binary files /dev/null and b/MultiVideoApplication/screenshots/device/phone.png differ diff --git a/MultiVideoApplication/screenshots/device/phone_EN.png b/MultiVideoApplication/screenshots/device/phone_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..93323e368a7582e926b3e27027a952a67df65cf6 Binary files /dev/null and b/MultiVideoApplication/screenshots/device/phone_EN.png differ diff --git a/MultiVideoApplication/screenshots/device/tablet.png b/MultiVideoApplication/screenshots/device/tablet.png new file mode 100644 index 0000000000000000000000000000000000000000..d92bde600c8e7c74da301151a74b3021929bb1b6 Binary files /dev/null and b/MultiVideoApplication/screenshots/device/tablet.png differ diff --git a/MultiVideoApplication/screenshots/device/tablet_EN.png b/MultiVideoApplication/screenshots/device/tablet_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..9f51cb80d4afcfc11c622552d128e7659dac87d8 Binary files /dev/null and b/MultiVideoApplication/screenshots/device/tablet_EN.png differ diff --git a/ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets b/ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets index 81eafdf54bffeb7ef684de47a306affaf4aaade1..27f0dc2d77eb3c360ade72398592395802f4df59 100644 --- a/ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets +++ b/ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets @@ -33,7 +33,7 @@ struct ClickError { .scale({ x: this.scaleValue, y: this.scaleValue }) .onClick(() => { // When the animation is delivered, the count is increased by 1 - animateTo({ + this.getUIContext().animateTo({ curve: Curve.EaseInOut, duration: 350, onFinish: () => { diff --git a/ScreenFlickerSolution/entry/src/main/ets/pages/ClickRight.ets b/ScreenFlickerSolution/entry/src/main/ets/pages/ClickRight.ets index c8272b765886b3f974f3135aac0b375d550aa6e3..9149739ed017f21c5356148d9094f0d902cf87b1 100644 --- a/ScreenFlickerSolution/entry/src/main/ets/pages/ClickRight.ets +++ b/ScreenFlickerSolution/entry/src/main/ets/pages/ClickRight.ets @@ -35,7 +35,7 @@ struct ClickRight { .onClick(() => { // When the animation is delivered, the count is increased by 1 this.cnt = this.cnt + 1; - animateTo({ + this.getUIContext().animateTo({ curve: Curve.EaseInOut, duration: 350, onFinish: () => { diff --git a/ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets b/ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets index 7efdfbed45f10060dabc0f09497be18395be8c1d..bba6da70c34d3eb5784b5d97f00c9fc2473c5e2e 100644 --- a/ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets +++ b/ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets @@ -144,7 +144,7 @@ struct TabsRight { private startAnimateTo(duration: number, leftMargin: number, width: number) { this.isStartAnimateTo = true; - animateTo({ + this.getUIContext().animateTo({ duration: duration, // duration curve: Curve.Linear, // curve iterations: 1, // iterations