diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e2387db9456826b273aeeabadd605bd63f72d334 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.customdialoggathers", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2099c1aeaf5f552a1de131a6223387fa651b74c6 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "自定义弹窗集合" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/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/README.en.md b/README.en.md deleted file mode 100644 index f24b7a4665d7c47cee9a66f8bd5b6fa366352116..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# CustomDialogGathers - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 47916289ab895e576cf246ee039e904ad7dcd0c6..0062bb17554931134e896951694c3b4e0d399d5c 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,75 @@ -# CustomDialogGathers +# 自定义弹窗合集 -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +### 介绍 -#### 软件架构 -软件架构说明 +本示例使用自定义弹窗(CustomDialog)、全屏模态转场(bindContentCover)、半模态转场(bindSheet)等实现多种自定义弹窗。 +### 效果预览 -#### 安装教程 +![](screenshots/device/custom.gif) -1. xxxx -2. xxxx -3. xxxx +使用说明: -#### 使用说明 +加载完成后显示首页的8个自定义弹窗类别,点击对应按钮,进入相应的弹窗页面: +1. 滑动选择弹窗:点击页面底部两个按钮,会弹出对应的12小时制的时间选择器弹窗和文本选择器弹窗。 +2. 模态弹窗:点击页面底部选择乘车人,会弹出模态弹窗,点击模态弹窗底部确认按钮,关闭模态弹窗。 +3. 半模态弹窗:点击页面中选择点餐口味和餐具按钮,弹出半模态弹窗,点击遮罩层关闭弹窗。 +4. toast弹窗:点击底部按钮,会弹出登陆成功的toast弹窗,3s后弹窗淡出消失。 +5. 隐私协议弹窗:点击底部按钮弹出隐私协议弹窗,弹窗内容可以滚动,橙色的隐私协议可以点击,点击后会跳转到新页面,点击新页面的返回按钮回到隐私弹窗页面,弹窗不会关闭,点击同意或不同意关闭弹窗。 +6. 全屏弹窗:点击底部按钮弹出全屏弹窗,点击左上角向下箭头可直接关闭弹窗;通过向下滑动会有阻尼效果,当滑动距离大于300时,弹窗会关闭,否则回弹到原位置。 +7. 自定义日历选择器弹窗:点击页面中的日期会弹出日期选择器弹窗,当前日期之前的日期不可选,之后的日期可选,选择完成后弹窗关闭,日期更改为选中的日期。 +8. 两级半模态+全屏弹窗:点击open sheet1按钮弹出第一个半模态弹窗,点击里面的输入框,弹出的键盘不避让,点击close sheets1按钮会关闭第一个弹窗;点击open sheets2按钮会打开第二个半模态弹窗,第二个半模态弹窗中有两个按钮,点击close sheets2按钮只会关闭第二个半模态弹窗,点击close sheet1 sheet2按钮会关闭第一个和第二个半模态弹窗。 -1. xxxx -2. xxxx -3. xxxx +### 工程目录 -#### 参与贡献 +``` +├──entry/src/main/ets/ +│ ├──common/constant +│ │ └──CommonConstants.ets // 公共常量类 +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──pages +│ │ ├──Index.ets // 首页 +│ │ ├──BindContentCoverDemo.ets // 模态弹窗页面 +│ │ ├──BindSheet.ets // 半模态弹窗页面 +│ │ ├──CustomCalendar.ets // 自定义日历选择器弹窗页面 +│ │ ├──FullScreen.ets // 全屏弹窗页面 +│ │ ├──Privacy.ets // 隐私协议弹窗页面 +│ │ ├──ScrollOption.ets // 滑动选择弹窗页面 +│ │ └──TwoLevelPageSheet.ets // 两级半模态+全屏弹窗页面 +│ ├──view +│ │ └──CustomCalendarPickerDialog.ets // 自定义日历弹窗组件 +│ └──viewmodel +│ ├──BindContentModel.ets // 模态弹窗接口和数据 +│ ├──DataManager.ets // 数据存储类 +│ ├──DateModel.ets // 日期类 +│ ├──GetDate.ets // 获取日期函数 +│ └──MonthDataSource.ets // 月份数据类 +└──entry/src/main/resources // 应用资源目录 +``` -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +### 具体实现 +1. 滑动选择弹窗:通过TimePickerDialog.show(时间选择器弹窗)和TextPickerDialog.show(文本选择器弹窗)两个组件来实现。 +2. 模态弹窗:通过bindContentCover属性为组件绑定全屏模态页面,点击后显示模态页面。模态页面内容自定义,显示方式可设置无动画过渡,上下切换过渡以及透明渐变过渡方式。 +3. 半模态弹窗:通过bindSheet属性为组件绑定半模态页面,点击后显示半模态页面。 +4. toast弹窗:使用自定义弹窗(CustomDialog)来模拟toast提示弹窗,通过设置CustomDialogController类的各种属性值实现效果。 +5. 隐私协议弹窗:通过Stack组件层叠模拟实现弹窗,使用visibility属性控制弹窗显示隐藏,实现点击跳转到新页面,点击新页面的返回按钮回到隐私弹窗页面,弹窗不会关闭的效果。 +6. 全屏弹窗:通过translate属性将全屏页面隐藏在可视区外,点击全屏弹窗按钮,通过显示动画将全屏弹窗显示出来;在gesture属性内通过PanGesture拖动手势事件,来实现当向下滑动大于300时,弹窗会关闭,否则回弹到原位置。 +7. 自定义日历选择器弹窗:使用自定义弹窗(CustomDialog)来实现自定义日历选择器,使用LazyForEach组件循环遍历实现月份,本示例值显示两个月(当前月份与下一个月),使用ForEach来遍历每个月的每一天。 +8. 两级半模态+全屏弹窗:通过bindSheet属性为open sheet1按钮组件绑定第一个半模态页面,给第一个半模态页面中open sheet2绑定第二个半模态页面,从而实现两级半模态弹窗。 +### 相关权限 +不涉及 -#### 特技 +### 依赖 +不涉及 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +### 约束与限制 + +1.本示例仅支持标准系统上运行,支持设备:华为手机。 + +2.HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 + +3.DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 + +4.HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,35 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..808380f3b726e2036a3d6cf5fb9b0fd9513a8215 --- /dev/null +++ b/entry/build-profile.json5 @@ -0,0 +1,25 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/entry/hvigorfile.ts b/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/entry/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/entry/oh-package.json5 b/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f629e34e15e586dbb0af7b6e3c16498eb030297 --- /dev/null +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -0,0 +1,229 @@ +/* + * 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 { + + /** + * Month. + */ + static readonly MONTHS = 12; + + /** + * January. + */ + static readonly JANUARY = 1; + + /** + * A week. + */ + static readonly WEEK_NUMBER = 7; + + /** + * Month number. + */ + static readonly MONTH_NUMBER = 35; + + /** + * Small grid height. + */ + static readonly GRID_HEIGHT_L = 360; + + /** + * Large grid height. + */ + static readonly GRID_HEIGHT_M = 300; + + /** + * Outside margin. + */ + static readonly ELEMENTS_MARGIN = 12; + + /** + * One hundred percent. + */ + static readonly ONE_HUNDRED_PERCENT: string = '100%'; + + /** + * One hundred eleven percent. + */ + static readonly ONE_HUNDRED_ELEVEN_PERCENT: string = '111%'; + + /** + * Ninety two percent. + */ + static readonly NINETY_PERCENT: string = '90%'; + + /** + * Ninety two percent. + */ + static readonly NINETY_TWO_PERCENT: string = '92%'; + + /** + * Ninety five percent. + */ + static readonly NINETY_FIVE_PERCENT: string = '95%'; + + /** + * Eighty five percent. + */ + static readonly EIGHTY_FIVE_PERCENT: string = '85%'; + + /** + * Thirty percent. + */ + static readonly THIRTY_PERCENT: string = '30%'; + + /** + * Forty percent. + */ + static readonly FORTY_PERCENT: string = '40%'; + + /** + * Seventy-five percent. + */ + static readonly SEVENTY_FIVE_PERCENT: string = '75%'; + + /** + * Rotation angle. + */ + static readonly ANGLE: number = 45; + + /** + * Line Spacing. + */ + static readonly SPACE: number = 15; + + /** + * Moving distance. + */ + static readonly TRANSLATE: number = 1000; + + /** + * Zero six. + */ + static readonly ZERO_SIX: number = 0.6; + + /** + * Zero eight. + */ + static readonly ZERO_EIGHT: number = 0.8; + + /** + * Duration. + */ + static readonly DURATION: number = 1200; + + /** + * Delay. + */ + static readonly DELAY: number = 500; + + /** + * GridCount. + */ + static readonly GRID_COUNT: number = 2; + + /** + * Zero. + */ + static readonly ZERO: number = 0; + + /** + * Four + */ + static readonly FOUR: number = 4; + + /** + * Eight. + */ + static readonly EIGHT: number = 8; + + /** + * Twelves. + */ + static readonly TWELVES: number = 12; + + /** + * Space. + */ + static readonly SPACE_ONE: number = 20; + + /** + * Element margin large. + */ + static readonly ELEMENTS_MARGIN_L: number = 24; + + /** + * Element margin small. + */ + static readonly ELEMENTS_MARGIN_M: number = 8; + + /** + * 0.0. + */ + static readonly ZERO_ZERO: number = 0.0; + + /** + * 0.3. + */ + static readonly ZERO_Three: number = 0.3; + + /** + * 1.0. + */ + static readonly ONE_ZERO: number = 1.0; + + /** + * Privacy pop-up window content 1. + */ + static readonly TEXT_ONE: string = '根据《常见类型移动互联网应用程序必要个人信息范围规定》,主要功能为购买商品,必要个人信息为:' + + '注册用户电话号码;收货人姓名、地址、联系电话;支付时间、支付金额、支付渠道等。请您在使用我们的服务前仔细阅读'; + + /** + * Privacy pop-up window content 2. + */ + static readonly TEXT_TWO: string = '。请您知悉,同意隐私政策仅代表您已了解应用提供功能,以及功能运行所需的必要个人信息。基于您的授权我们可能会获取您的位置等信息,您有权拒绝或取消授权;' + + '我们会采取业界先进的安全措施保护您的信息安全;未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;您可以查询、更正、删除您的个人信息'; + + /** + * Edit. + */ + static readonly EDIT: string = '编辑'; + + /** + * Saturday. + */ + static readonly SATURDAY: string = '六'; + + /** + * Sunday. + */ + static readonly SUNDAY: string = '日'; + + /** + * Seven grid. + */ + static readonly GRID_SEVEN: string = '1fr 1fr 1fr 1fr 1fr 1fr 1fr'; + + /** + * Six grid. + */ + static readonly GRID_SIX: string = '1fr 1fr 1fr 1fr 1fr 1fr'; + + /** + * Five grid. + */ + static readonly GRID_FIVE: string = '1fr 1fr 1fr 1fr 1fr'; +} \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..a32a8361c7fcad66acf12208583e198fc4e68dab --- /dev/null +++ b/entry/src/main/ets/entryability/EntryAbility.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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +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.loadContent('pages/Index', (err) => { + 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.'); + }); + } + + 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/entry/src/main/ets/pages/BindContentCoverDemo.ets b/entry/src/main/ets/pages/BindContentCoverDemo.ets new file mode 100644 index 0000000000000000000000000000000000000000..6051c7a292d72468f3376d2d58c77077ac7bc401 --- /dev/null +++ b/entry/src/main/ets/pages/BindContentCoverDemo.ets @@ -0,0 +1,168 @@ +/* + * 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 { curves } from '@kit.ArkUI'; +import { ComposeListItem } from "@kit.ArkUI"; +import { CommonConstants } from '../common/constants/CommonConstants'; +import { PersonList, personList } from '../viewmodel/BindContentModel'; + +@Entry +@Component +struct BindContentCoverDemo { + private personList: Array = personList; + @State isPresent: boolean = false; + + @Builder + MyBuilder() { + Column() { + Row() + .backgroundColor(Color.White) + .height($r('app.float.blank_height')) + Row() { + Text($r('app.string.select_person')) + .fontSize($r('app.float.font_size')) + .fontColor(Color.Black) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .textAlign(TextAlign.Center) + .padding({ + top: $r('app.float.corner_radius_default_m'), + bottom: $r('app.float.column_padding') + }) + } + .backgroundColor($r('app.color.start_window_background')) + + Row() { + Text($r('app.string.add_person')) + .fontSize($r('app.float.font_size1')) + .fontColor($r('app.color.color_bind_sheet')) + .margin({ top: $r('app.float.text_margin') }) + .padding({ top: $r('app.float.train_image_size'), bottom: $r('app.float.train_image_size') }) + .width(CommonConstants.NINETY_TWO_PERCENT) + .borderRadius($r('app.float.text_size_headline')) + .textAlign(TextAlign.Center) + .backgroundColor(Color.White) + } + .margin({ bottom: $r('app.float.text_margin') }) + + Column() { + ForEach(this.personList, (item: PersonList, index: number) => { + Row() { + if (index % 2 == 0) { + Checkbox() + .select(true) + } else { + Checkbox() + .select(false) + } + ComposeListItem({ + contentItem: ({ + primaryText: item.name, + secondaryText: item.cardNum + }), + operateItem: ({ + text: CommonConstants.EDIT + }) + }) + } + .padding({ + left: $r('app.float.text_margin'), + right: $r('app.float.row_padding') + }) + }, (item: PersonList) => JSON.stringify(item)) + } + .width(CommonConstants.NINETY_TWO_PERCENT) + .backgroundColor(Color.White) + .borderRadius($r('app.float.text_size_headline')) + + Text($r('app.string.confirmed')) + .margin({ top: $r('app.float.margin_large') }) + .width(CommonConstants.NINETY_TWO_PERCENT) + .height($r('app.float.text_height')) + .textAlign(TextAlign.Center) + .borderRadius($r('app.float.train_image_size')) + .fontColor(Color.White) + .backgroundColor($r('app.color.color_warning')) + .onClick(() => { + this.isPresent = !this.isPresent; + }) + } + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .backgroundColor($r('app.color.dialog_background')) + .transition(TransitionEffect.translate({ y: CommonConstants.TRANSLATE }) + .animation({ + curve: curves.springMotion(CommonConstants.ZERO_SIX, CommonConstants.ZERO_EIGHT) + })) + } + + build() { + Navigation() { + Column() { + Row() { + Text($r('app.string.confirm_order')) + .fontSize($r('app.float.font_size')) + .fontColor(Color.White) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .textAlign(TextAlign.Center) + .padding({ top: $r('app.float.row_padding'), bottom: $r('app.float.row_height') }) + } + .backgroundColor($r('app.color.color_warning')) + + Column() { + Row() { + Column() { + Text($r('app.string.start_time')) + Text($r('app.string.start_string')) + } + .width(CommonConstants.THIRTY_PERCENT) + + Column() { + Text($r('app.string.car_name')) + Text($r('app.string.car_time')) + } + .width(CommonConstants.THIRTY_PERCENT) + + Column() { + Text($r('app.string.end_time')) + Text($r('app.string.end_name')) + } + .width(CommonConstants.THIRTY_PERCENT) + } + } + .width(CommonConstants.NINETY_TWO_PERCENT) + .padding($r('app.float.column_padding')) + .margin({ top: $r('app.float.column_margin') }) + .backgroundColor(Color.White) + .shadow({ radius: $r('app.float.row_padding'), color: $r('app.color.color_shadow') }) + .borderRadius($r('app.float.text_margin')) + + Column() { + Button($r('app.string.button_select')) + .fontSize($r('app.float.font_size3')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .borderRadius($r('app.float.text_size_headline')) + .bindContentCover(this.isPresent, this.MyBuilder(), ModalTransition.DEFAULT) + .onClick(() => { + this.isPresent = !this.isPresent; + }) + } + .height(CommonConstants.SEVENTY_FIVE_PERCENT) + .justifyContent(FlexAlign.End) + .padding({ left: $r('app.float.text_size_headline'), right: $r('app.float.text_size_headline') }) + } + } + .title($r('app.string.dialog_name')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/BindSheet.ets b/entry/src/main/ets/pages/BindSheet.ets new file mode 100644 index 0000000000000000000000000000000000000000..79793d7ccda1c0ad25e90df40e2d3d407c496cc0 --- /dev/null +++ b/entry/src/main/ets/pages/BindSheet.ets @@ -0,0 +1,100 @@ +/* + * 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 } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct BindSheetDemo { + @State isShowSheet: boolean = false; + private menuList: string[] = ['少放辣', '不需要辣', '需要一次性餐具', '多放辣', '不要香菜', '不要一次性餐具']; + @Builder mySheet() { + Column() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap }) { + ForEach(this.menuList, (item: string) => { + Text(item) + .fontSize($r('app.float.font_size1')) + .fontColor($r('app.color.color_bind_sheet')) + .backgroundColor($r('app.color.color_background_bind')) + .borderRadius($r('app.float.border_radius1')) + .margin($r('app.float.text_margin')) + .padding($r('app.float.text_margin')) + }) + } + .padding({ + top: $r('app.float.column_padding'), + left: $r('app.float.corner_radius_default_m') + }) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .backgroundColor(Color.White) + } + + build() { + Navigation() { + Column() { + Text($r('app.string.tastes')) + .fontSize($r('app.float.font_size5')) + .padding({ + top: $r('app.float.row_padding'), + bottom: $r('app.float.row_padding') + }) + Column() { + Row() { + Column() { + Text($r('app.string.choose_flavors')) + .fontSize($r('app.float.font_size1')) + .fontWeight(FontWeight.Medium) + } + .alignItems(HorizontalAlign.Start) + Blank() + Row() + .width($r('app.float.button_margin')) + .height($r('app.float.button_margin')) + .margin({ right: $r('app.float.column_padding') }) + .border({ + width: { top: $r('app.float.border'), right: $r('app.float.border') }, + color: $r('app.color.color_border') + }) + .rotate({ angle: CommonConstants.ANGLE }) + } + .borderRadius($r('app.float.column_padding')) + .shadow({ + radius: $r('app.float.shadow_radius'), + color: $r('app.color.shadow_color') + }) + .width(CommonConstants.NINETY_PERCENT) + .alignItems(VerticalAlign.Center) + .padding({ left: $r('app.float.column_padding'), top: $r('app.float.column_padding'), bottom: $r('app.float.column_padding') }) + .backgroundColor(Color.White) + .bindSheet(this.isShowSheet, this.mySheet(), { + height: $r('app.float.bind_sheet_height'), + dragBar: false, + showClose: false + }) + .onClick(() => { + this.isShowSheet = !this.isShowSheet; + }) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .backgroundColor($r('app.color.color_background_bind')) + } + .title($r('app.string.bind_sheet_dialog')) + .titleMode(NavigationTitleMode.Mini) + } +} diff --git a/entry/src/main/ets/pages/CustomCalendar.ets b/entry/src/main/ets/pages/CustomCalendar.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e100ff933fd6ecbdd1e685f5e2366c73176dc35 --- /dev/null +++ b/entry/src/main/ets/pages/CustomCalendar.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 { promptAction } from '@kit.ArkUI'; +import { CustomCalendarPickerDialog } from '../view/CustomCalendarPickerDialog'; +import { DateModel } from '../viewmodel/DateModel'; +import { getRealTimeDate } from '../viewmodel/GetDate'; +import { CommonConstants } from '../common/constants/CommonConstants'; + +@Entry +@Component +export struct CalendarView { + private week: string[] = ['日', '一', '二', '三', '四', '五', '六']; + @State currentMonth: number = 1; + @State currentDay: number = 1; + @State currentYear: number = 1; + @StorageLink('selectedDate') dateModel: DateModel = new DateModel(0, 0, 0, 0); + + aboutToAppear(): void { + this.dateModel = getRealTimeDate(); + this.currentMonth = this.dateModel.month; + this.currentDay = this.dateModel.day; + this.currentYear = this.dateModel.year; + } + + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomCalendarPickerDialog({ + currentMonth: this.currentMonth, + currentDay: this.currentDay, + currentYear: this.currentYear, + cancel: this.onCancel + }), + alignment: DialogAlignment.Bottom, + customStyle: true + }) + + onCancel() { + } + + @Builder + calendarMainView() { + Column({ space: CommonConstants.ELEMENTS_MARGIN_L }) { + Row() { + Text($r('app.string.departure')) + .fontSize($r('app.float.text_size_headline')) + Image($r('app.media.train_transport_icon')) + .height($r('app.float.train_image_size')) + .width($r('app.float.train_image_size')) + Text($r('app.string.destination')) + .fontSize($r('app.float.text_size_headline')) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + + Row({ space: CommonConstants.ELEMENTS_MARGIN_M }) { + Text(`${this.dateModel.month}月${this.dateModel.day}日`) + .fontSize($r('app.float.text_size_headline')) + Text(`星期${this.week[this.dateModel.week]}`) + .fontSize($r('app.float.text_size_body1')) + } + .justifyContent(FlexAlign.Start) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .onClick(() => { + this.dialogController.open(); + }) + + Button($r('app.string.check_ticket')) + .fontSize($r('app.float.text_size_headline')) + .height($r('app.float.check_button_height')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .type(ButtonType.Normal) + .borderRadius($r('app.float.corner_radius_default_m')) + .onClick(() => { + promptAction.showToast({ + message: $r('app.string.button_text') + }); + }) + } + .backgroundColor($r('app.color.start_window_background')) + .padding($r('app.float.card_padding')) + .borderRadius($r('app.float.corner_radius_default_m')) + } + + build() { + Navigation() { + Column() { + this.calendarMainView() + } + .backgroundColor($r('app.color.color_sub_background')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .padding($r('app.float.corner_radius_default_m')) + } + .title($r('app.string.calendar_dialog')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Details.ets b/entry/src/main/ets/pages/Details.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c5e00b9ef27637d4f49eac847785fcc69227be1 --- /dev/null +++ b/entry/src/main/ets/pages/Details.ets @@ -0,0 +1,34 @@ +/* + * 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 { router } from '@kit.ArkUI'; + +@Entry +@Component +struct Details { + @State message: string = '隐私详情'; + + build() { + Row() { + Column() { + Button('返回').onClick(() => { + router.back(); + }) + } + .width('100%') + } + .alignItems(VerticalAlign.Center) + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/FullScreen.ets b/entry/src/main/ets/pages/FullScreen.ets new file mode 100644 index 0000000000000000000000000000000000000000..37d1e37b505fa41c212467f9ff6eddcfde2c2e17 --- /dev/null +++ b/entry/src/main/ets/pages/FullScreen.ets @@ -0,0 +1,203 @@ +/* + * 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 { curves } from '@kit.ArkUI'; +import { CommonConstants } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct FullScreen { + private positionY: number = 0; + @State translateY: string | number = '110%'; + + build() { + Stack() { + Navigation() { + Column() { + Button($r('app.string.full_screen')) + .onClick(() => { + animateTo({ + duration: CommonConstants.DURATION, + curve: Curve.Sharp + }, () => { + this.translateY = '0%'; + }); + }) + .margin({ bottom: $r('app.float.card_padding') }) + } + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .justifyContent(FlexAlign.End) + } + .title($r('app.string.full_screen')) + .titleMode(NavigationTitleMode.Mini) + + RelativeContainer() { + Image($r('sys.media.ohos_ic_public_arrow_down')) + .fillColor($r('app.color.shadow_color')) + .width($r('app.float.check_button_height')) + .height($r('app.float.calendar_height')) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + left: { anchor: '__container__', align: HorizontalAlign.Start } + }) + .margin({ + top: $r('app.float.check_button_height'), + left: $r('app.float.corner_radius_default_m') + }) + .onClick(() => { + this.closeSelf(); + }) + .id('button') + + Row() { + } + .width($r('app.float.shadow_radius')) + .height($r('app.float.row_padding')) + .backgroundColor("#EAEDED") + .borderRadius($r('app.float.text_margin')) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + left: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .margin({ top: $r('app.float.row_height') }) + .offset({ x: $r('app.float.offset_x') }) + .id('title') + + Row() { + } + .width($r('app.float.bind_sheet_height')) + .height($r('app.float.bind_sheet_height')) + .clipShape(new Circle({ width: CommonConstants.GRID_HEIGHT_M, height: CommonConstants.GRID_HEIGHT_M })) + .backgroundColor($r('app.color.shadow_color')) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Center }, + left: { anchor: "__container__", align: HorizontalAlign.Center }, + }) + .offset({ x: $r('app.float.offset_x_l'), y: $r('app.float.offset_y') }) + .id('main') + + Row() { + } + .width($r('app.float.width_l')) + .height($r('app.float.text_margin')) + .backgroundColor($r('app.color.shadow_color')) + .borderRadius($r('app.float.border_radius5')) + .alignRules({ + top: { anchor: "main", align: VerticalAlign.Bottom }, + left: { anchor: '__container__', align: HorizontalAlign.Center } + }) + .margin({ top: $r('app.float.text_margin') }) + .offset({ x: $r('app.float.offset_x_m'), y: $r('app.float.offset_y_l') }) + .id('slider') + + Image($r('sys.media.ohos_ic_public_play')) + .fillColor($r('app.color.shadow_color')) + .width($r('app.float.row_height')) + .height($r('app.float.row_height')) + .alignRules({ + top: { anchor: "slider", align: VerticalAlign.Bottom }, + left: { anchor: '__container__', align: HorizontalAlign.Center } + }) + .offset({ x: $r('app.float.column_margin'), y: $r('app.float.offset_x') }) + .id('play') + + Image($r('sys.media.ohos_ic_public_play_next')) + .fillColor($r('app.color.shadow_color')) + .width($r('app.float.row_height')) + .height($r('app.float.row_height')) + .alignRules({ + top: { anchor: "slider", align: VerticalAlign.Bottom }, + right: { anchor: '__container__', align: HorizontalAlign.End } + }) + .offset({ x: $r('app.float.offset_20'), y: $r('app.float.offset_x') }) + .id('playNext') + + Image($r('sys.media.ohos_ic_public_play_last')) + .fillColor($r('app.color.shadow_color')) + .width($r('app.float.row_height')) + .height($r('app.float.row_height')) + .alignRules({ + top: { anchor: "slider", align: VerticalAlign.Bottom }, + left: { anchor: '__container__', align: HorizontalAlign.Start } + }) + .offset({ x: $r('app.float.train_image_size'), y: $r('app.float.offset_x') }) + .id('playPrev') + + } + .linearGradient({ + colors: [ + [$r('app.color.color_linear1'), CommonConstants.ZERO_ZERO], + [$r('app.color.color_linear2'), CommonConstants.ZERO_Three], + [$r('app.color.color_linear3'), CommonConstants.ONE_ZERO] + ] + }) + .borderRadius({ + topLeft: $r('app.float.column_padding'), + topRight: $r('app.float.column_padding') + }) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .translate({ x: CommonConstants.ZERO, y: this.translateY }) + .gesture( + PanGesture({ direction: PanDirection.Vertical, distance: CommonConstants.JANUARY }) + .onActionUpdate((event?: GestureEvent) => { + this.handlePanGestureUpdate(event?.offsetY); + }) + .onActionEnd((event?: GestureEvent) => { + this.handlePanGestureEnd(event?.offsetY); + }) + ) + } + } + + private closeSelf() { + animateTo({ + duration: CommonConstants.GRID_HEIGHT_M, + curve: Curve.Sharp, + }, () => { + this.translateY = '110%'; + }); + } + + private reset() { + animateTo({ + curve: curves.responsiveSpringMotion() + }, () => { + this.translateY = '0%'; + this.positionY = 0; + }); + } + + handlePanGestureUpdate(offsetY?: number): void { + if (!offsetY || offsetY < 0) { + return; + } + animateTo({ + curve: curves.responsiveSpringMotion() + }, () => { + this.translateY = this.positionY + offsetY; + }); + } + + handlePanGestureEnd(offsetY?: number): void { + if (!offsetY) { + return; + } + if (offsetY > 300) { + this.closeSelf(); + } else { + this.reset(); + } + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c193aa19a8dfb6637c2e0f8e600e1261512de61a --- /dev/null +++ b/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,82 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import { CommonConstants } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct Index { + @Builder + Options(name: Resource, url: string) { + Row() { + Column() { + Text(name) + .fontSize($r('app.float.card_padding')) + .fontWeight(FontWeight.Medium) + } + .alignItems(HorizontalAlign.Start) + + Blank() + Row() + .width($r('app.float.button_margin')) + .height($r('app.float.button_margin')) + .margin({ right: $r('app.float.column_padding') }) + .border({ + width: { top: $r('app.float.border'), right: $r('app.float.border') }, + color: $r('app.color.color_border') + }) + .rotate({ angle: CommonConstants.ANGLE }) + } + .borderRadius($r('app.float.text_size_headline')) + .shadow({ + radius: $r('app.float.shadow_radius'), + color: $r('app.color.shadow_color') + }) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height($r('app.float.row_height')) + .alignItems(VerticalAlign.Center) + .padding({ + left: $r('app.float.column_padding'), + top: $r('app.float.column_padding'), + bottom: $r('app.float.column_padding') + }) + .backgroundColor(Color.White) + .onClick(() => { + router.pushUrl({ + url + }) + }) + } + + build() { + Column({ space: CommonConstants.SPACE }) { + Text($r('app.string.index_name')) + .fontSize($r('app.float.font_size4')) + .margin({ bottom: $r('app.float.text_margin') }) + this.Options($r('app.string.scroll_option'), 'pages/ScrollOption') + this.Options($r('app.string.dialog_name'), 'pages/BindContentCoverDemo') + this.Options($r('app.string.bind_sheet_dialog'), 'pages/BindSheet') + this.Options($r('app.string.toast_dialog'), 'pages/Toast') + this.Options($r('app.string.toast_private_dialog'), 'pages/Privacy') + this.Options($r('app.string.full_screen'), 'pages/FullScreen') + this.Options($r('app.string.calendar_dialog'), 'pages/CustomCalendar') + this.Options($r('app.string.two_level_dialog'), 'pages/TwoLevelPageSheet') + } + .padding($r('app.float.column_padding')) + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .backgroundColor($r('app.color.color_background')) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Privacy.ets b/entry/src/main/ets/pages/Privacy.ets new file mode 100644 index 0000000000000000000000000000000000000000..afbb9b83169c14d65e0f2703bc240288cc36ac13 --- /dev/null +++ b/entry/src/main/ets/pages/Privacy.ets @@ -0,0 +1,138 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import { CommonConstants } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct Privacy { + @State visible: Visibility = Visibility.None; + scroller: Scroller = new Scroller(); + private pointsArr: string[] = ['400vp', '600vp', '800vp']; + + build() { + Navigation() { + Stack() { + Row() { + Column() { + Button($r('app.string.button_name1')) + .onClick(() => { + if (this.visible === Visibility.Visible) { + this.visible = Visibility.None; + } else { + this.visible = Visibility.Visible; + } + }) + .fontColor(Color.White) + .margin({ bottom: $r('app.float.text_size_headline') }) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + } + .alignItems(VerticalAlign.Bottom) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + Column() { + GridRow({ + columns: { + xs: CommonConstants.JANUARY, + sm: CommonConstants.FOUR, + md: CommonConstants.EIGHT, + lg: CommonConstants.TWELVES + }, + breakpoints: { + value: this.pointsArr, + reference: BreakpointsReference.WindowSize + } + }) { + GridCol({ + span: { + xs: CommonConstants.JANUARY, + sm: CommonConstants.GRID_COUNT, + md: CommonConstants.FOUR, + lg: CommonConstants.EIGHT + }, + offset: { + xs: CommonConstants.ZERO, + sm: CommonConstants.JANUARY, + md: CommonConstants.GRID_COUNT, + lg: CommonConstants.GRID_COUNT + } + }) { + Column() { + Text($r('app.string.button_name2')) + .height($r('app.float.button_height1')) + .fontSize($r('app.float.font_size3')) + .fontWeight(FontWeight.Bold) + + Scroll(this.scroller) { + Text() { + Span(CommonConstants.TEXT_ONE) + Span($r('app.string.toast_text')) + .fontColor(Color.Orange) + .fontWeight(FontWeight.Bold) + .decoration({ type: TextDecorationType.Underline, color: Color.Orange }) + .onClick(() => { + router.pushUrl({ + url: 'pages/Details' + }) + }) + Span(CommonConstants.TEXT_TWO) + } + .fontSize($r('app.float.font_size1')) + .padding({ + left: $r('app.float.column_padding'), + right: $r('app.float.column_padding') + }) + } + .scrollable(ScrollDirection.Vertical) + .height($r('app.float.dialog_height')) + Row({ space: CommonConstants.SPACE_ONE }) { + Button($r('app.string.disagree'), { stateEffect: false, buttonStyle: ButtonStyleMode.TEXTUAL}) + .onClick(() => { + if (this.visible === Visibility.Visible) { + this.visible = Visibility.None; + } else { + this.visible = Visibility.Visible; + } + }) + .width(CommonConstants.FORTY_PERCENT) + Button($r('app.string.agreed'), { type: ButtonType.Capsule }) + .onClick(() => { + if (this.visible === Visibility.Visible) { + this.visible = Visibility.None; + } else { + this.visible = Visibility.Visible; + } + }) + .width(CommonConstants.FORTY_PERCENT) + } + .alignItems(VerticalAlign.Top) + .margin({ top: $r('app.float.border_radius1') }) + .height($r('app.float.button_height1')) + } + .backgroundColor(Color.White) + .visibility(this.visible) + .borderRadius($r('app.float.border_radius3')) + .width($r('app.float.bind_sheet_height')) + } + } + } + .width(CommonConstants.NINETY_FIVE_PERCENT) + } + } + .backgroundColor($r('app.color.dialog_background')) + .title($r('app.string.toast_private_dialog')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/ScrollOption.ets b/entry/src/main/ets/pages/ScrollOption.ets new file mode 100644 index 0000000000000000000000000000000000000000..60bb92c5610fb237763fb41b58e2de211444b44e --- /dev/null +++ b/entry/src/main/ets/pages/ScrollOption.ets @@ -0,0 +1,64 @@ +/* + * 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 } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct ScrollOption { + private selectTime: Date = new Date('2024-4-17T18:30:00'); + @State select: number = 2; + private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5']; + + build() { + Navigation() { + Column() { + Button($r('app.string.button_scroll_option1')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.button_margin') }) + .onClick(() => { + TimePickerDialog.show({ + selected: this.selectTime, + backgroundColor: $r('app.color.start_window_background'), + onAccept: (value: TimePickerResult) => { + this.selectTime.setHours(value.hour, value.minute); + } + }) + }) + Button($r('app.string.button_scroll_option2')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.card_padding') }) + .onClick(() => { + TextPickerDialog.show({ + range: this.fruits, + selected: this.select, + backgroundColor: $r('app.color.start_window_background'), + onAccept: (value: TextPickerResult) => { + this.select = value.index as number; + } + }) + }) + } + .justifyContent(FlexAlign.End) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + .padding({ + left: $r('app.float.card_padding'), + right: $r('app.float.card_padding') + }) + } + .title($r('app.string.scroll_option')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Toast.ets b/entry/src/main/ets/pages/Toast.ets new file mode 100644 index 0000000000000000000000000000000000000000..faf3c7d7451d62ac83e30c0ed34a2b16345ddc53 --- /dev/null +++ b/entry/src/main/ets/pages/Toast.ets @@ -0,0 +1,87 @@ +/* + * 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 } from '../common/constants/CommonConstants'; + +@CustomDialog +struct CustomDialogExample { + controller?: CustomDialogController; + + build() { + Column() { + Text($r('app.string.login')) + .fontSize($r('app.float.font_size1')) + .fontColor(Color.Black) + .height($r('app.float.toast_height')) + } + .backgroundColor($r('app.color.start_window_background')) + .borderRadius($r('app.float.border_radius2')) + .width($r('app.float.toast_width')) + } +} + +@Entry +@Component +struct CustomDialogUser { + @State textValue: string = ''; + @State inputValue: string = '点击Toast'; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample(), + openAnimation: { + duration: CommonConstants.DURATION, + curve: Curve.Friction, + delay: CommonConstants.DELAY, + playMode: PlayMode.Alternate + }, + closeAnimation: { + duration: CommonConstants.DURATION, + curve: Curve.Friction, + delay: CommonConstants.DELAY, + playMode: PlayMode.Alternate + }, + alignment: DialogAlignment.Bottom, + offset: { dx: CommonConstants.ZERO, dy: $r('app.float.offset_dy') }, + customStyle: true, + cornerRadius: $r('app.float.corner_radius'), + isModal: false + }) + + aboutToDisappear() { + this.dialogController = null; + } + + build() { + Navigation() { + Column() { + Button(this.inputValue) + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open(); + setTimeout(() => { + this.dialogController?.close(); + }, 3000) + } + }) + .backgroundColor($r('app.color.color_warning')) + .margin({ bottom: $r('app.float.bottom_margin') }) + } + .height(CommonConstants.ONE_HUNDRED_ELEVEN_PERCENT) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .justifyContent(FlexAlign.End) + .backgroundColor($r('app.color.color_background')) + } + .title($r('app.string.toast_dialog')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/TwoLevelPageSheet.ets b/entry/src/main/ets/pages/TwoLevelPageSheet.ets new file mode 100644 index 0000000000000000000000000000000000000000..8248ca56861674d00e7f63ca8313eb6eda6228e8 --- /dev/null +++ b/entry/src/main/ets/pages/TwoLevelPageSheet.ets @@ -0,0 +1,114 @@ +/* + * 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 } from '../common/constants/CommonConstants'; + +@Entry +@Component +struct TwoLevelPageSheet { + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: string = '60%'; + @State sheetHeight2: number = 200; + @State showDragBar: boolean = true; + @State showDragBar2: boolean = true; + + @Builder + myBuilder() { + Column() { + TextInput() + .margin({ + top: $r('app.float.margin_top'), + left: $r('app.float.corner_radius'), + right: $r('app.float.corner_radius') + }) + Row({ space: CommonConstants.SPACE_ONE }) { + Button($r('app.string.button_two')) + .fontSize($r('app.float.font_size')) + .onClick(() => { + this.isShow = false; + }) + Button($r('app.string.button_three')) + .fontSize($r('app.float.font_size')) + .onClick(() => { + this.isShow2 = true; + }) + .bindSheet($$this.isShow2, this.myBuilder2(), + { + height: this.sheetHeight2, + dragBar: this.showDragBar2, + backgroundColor: $r('app.color.color_background'), + maskColor: Color.Black, + }) + } + .margin({ bottom: $r('app.float.builder_height') }) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + } + + @Builder + myBuilder2() { + Column() { + Button($r('app.string.button_four')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .margin({ bottom: $r('app.float.button_margin') }) + .fontSize($r('app.float.font_size')) + .onClick(() => { + this.isShow2 = false; + }) + Button($r('app.string.button_five')) + .margin({ bottom: $r('app.float.builder_height') }) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .fontSize($r('app.float.font_size')) + .onClick(() => { + this.isShow = false; + this.isShow2 = false; + }) + } + .padding({ + left: $r('app.float.card_padding'), + right: $r('app.float.card_padding') + }) + .justifyContent(FlexAlign.End) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + } + + build() { + Navigation() { + Column() { + Button($r('app.string.button_one')) + .onClick(() => { + this.isShow = true + }) + .margin({ bottom: $r('app.float.card_padding') }) + .fontSize($r('app.float.font_size')) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + dragBar: this.showDragBar, + backgroundColor: $r('app.color.dialog_background'), + maskColor: Color.Black, + }) + } + .justifyContent(FlexAlign.End) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.ONE_HUNDRED_PERCENT) + } + .title($r('app.string.two_level_dialog')) + .titleMode(NavigationTitleMode.Mini) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/view/CustomCalendarPickerDialog.ets b/entry/src/main/ets/view/CustomCalendarPickerDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..c08c20c13c0c298d5bf620bfc70b05522349598d --- /dev/null +++ b/entry/src/main/ets/view/CustomCalendarPickerDialog.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. + */ +import { getMonthDate } from '../viewmodel/GetDate'; +import { MonthDataSource, Month } from '../viewmodel/MonthDataSource'; +import { DataManager } from '../viewmodel/DataManager'; +import { DateModel } from '../viewmodel/DateModel'; +import { CommonConstants } from '../common/constants/CommonConstants'; + +@CustomDialog +export struct CustomCalendarPickerDialog { + @State contentData: MonthDataSource = new MonthDataSource(); + @State nextMonth: number = 1; + @State nextYear: number = 1; + @State nextMonthDay: number[] = []; + @State currentMonthDay: number[] = []; + @State initialIndex: number = 0; + @Link currentMonth: number; + @Link currentDay: number; + @Link currentYear: number; + @StorageLink('selectedDate') dateModel: DateModel = new DateModel(0, 0, 0, 0); + controller: CustomDialogController; + cancel: () => void = () => {}; + private week: string[] = ['日', '一', '二', '三', '四', '五', '六']; + + aboutToAppear() { + this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear); + if (this.currentMonth === CommonConstants.MONTHS) { + this.nextMonth = CommonConstants.JANUARY; + this.nextYear = this.currentYear + 1; + } else { + this.nextMonth = this.currentMonth + 1; + this.nextYear = this.currentYear; + } + this.nextMonthDay = getMonthDate(this.nextMonth, this.nextYear); + let months: Month[] = [ + { + month: `${this.currentYear}年 ${this.currentMonth}月`, + num: this.currentMonth, + days: this.currentMonthDay + }, + { + month: `${this.nextYear}年 ${this.nextMonth}月`, + num: this.nextMonth, + days: this.nextMonthDay + } + ] + this.contentData.pushData(months); + this.initialIndex = this.dateModel.month > this.currentMonth ? 1 : 0; + } + + @Builder + itemHead(text: string) { + Text(text) + .backgroundColor($r('app.color.color_sub_background')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height($r('app.float.text_height')) + .textAlign(TextAlign.Center) + } + + build() { + Column({ space: CommonConstants.ELEMENTS_MARGIN }) { + Text($r('app.string.departure_date')) + .fontSize($r('app.float.text_size_headline')) + List() { + ForEach(this.week, (weekInformation: string) => { + ListItem() { + Text(weekInformation) + .textAlign(TextAlign.Center) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height($r('app.float.text_size_headline')) + .fontColor(weekInformation === CommonConstants.SUNDAY || weekInformation === + CommonConstants.SATURDAY ? $r('app.color.color_warning') : $r('app.color.color_text_primary')) + } + .width($r('app.string.week_width')) + }) + } + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height($r('app.float.text_size_headline')) + .listDirection(Axis.Horizontal) + .scrollBar(BarState.Off) + + List({ initialIndex: this.initialIndex }) { + LazyForEach(this.contentData, (monthItem: Month) => { + ListItemGroup({ header: this.itemHead(monthItem.month) }) { + ListItem() { + Grid() { + ForEach(monthItem.days, (day: number) => { + GridItem() { + if (day === this.dateModel.day && monthItem.num === this.dateModel.month) { + Text(day.toString()) + .fontSize($r('app.float.text_size_headline')) + .fontColor($r('app.color.start_window_background')) + } else { + Text(day.toString()) + .fontSize($r('app.float.text_size_headline')) + .fontColor(day < this.currentDay && monthItem.num === + this.currentMonth ? $r('app.color.color_text_secondary') : $r('app.color.color_text_primary')) + } + } + .height($r('app.float.calendar_height')) + .width($r('app.float.calendar_height')) + .borderRadius($r('app.float.corner_radius_default_l')) + .backgroundColor(day === this.dateModel.day && monthItem.num === + this.dateModel.month ? $r('app.color.color_warning') : $r('app.color.start_window_background')) + .opacity(day === CommonConstants.ZERO ? CommonConstants.ZERO : CommonConstants.JANUARY) + .onClick(() => { + if (day >= this.currentDay || monthItem.num > this.currentMonth) { + let weekIndex = monthItem.days.indexOf(day) % CommonConstants.WEEK_NUMBER; + this.dateModel.day = day; + this.dateModel.week = weekIndex; + this.dateModel.month = monthItem.num; + DataManager.setDate(getContext(this), this.dateModel, () => {}); + this.controller.close(); + } + }) + }, (day: number) => JSON.stringify(day)) + } + .backgroundColor($r('app.color.start_window_background')) + .columnsTemplate(CommonConstants.GRID_SEVEN) + .rowsTemplate(monthItem.days.length > CommonConstants.MONTH_NUMBER ? + CommonConstants.GRID_SIX : CommonConstants.GRID_FIVE) + .height(monthItem.days.length > CommonConstants.MONTH_NUMBER ? CommonConstants.GRID_HEIGHT_L : + CommonConstants.GRID_HEIGHT_M) + } + } + }, (monthItem: Month) => JSON.stringify(monthItem)) + } + .height($r('app.string.calendar_height')) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .edgeEffect(EdgeEffect.None) + .scrollBar(BarState.Off) + .sticky(StickyStyle.Header) + } + .padding({ top: CommonConstants.ELEMENTS_MARGIN }) + .width(CommonConstants.ONE_HUNDRED_PERCENT) + .height(CommonConstants.EIGHTY_FIVE_PERCENT) + .borderRadius({ + topLeft: $r('app.float.corner_radius_default_l'), + topRight: $r('app.float.corner_radius_default_l') + }) + .backgroundColor($r('app.color.start_window_background')) + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/BindContentModel.ets b/entry/src/main/ets/viewmodel/BindContentModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..55eb2b787754cc8845df6ce0cd8a1eb9c203ce09 --- /dev/null +++ b/entry/src/main/ets/viewmodel/BindContentModel.ets @@ -0,0 +1,25 @@ +/* + * 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 PersonList { + name: string, + cardNum: string +} + +export const personList: PersonList[] = [ + { name: '王**', cardNum: '1234***********789' }, + { name: '宋*', cardNum: '2345***********789' }, + { name: '许**', cardNum: '3456***********789' }, + { name: '唐*', cardNum: '4567***********789' } +]; \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/DataManager.ets b/entry/src/main/ets/viewmodel/DataManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..65091d6019047d6fc9f6a67438396762007e5fe1 --- /dev/null +++ b/entry/src/main/ets/viewmodel/DataManager.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 dataPreferences from '@ohos.data.preferences'; +import { DateModel } from './DateModel'; +import { getRealTimeDate } from './GetDate'; + +export class DataManager { + static getDate(context: Context, callback: (dateModel: DateModel) => void) { + let dateModel: DateModel = getRealTimeDate(); + try { + let promise = dataPreferences.getPreferences(context, 'date'); + promise.then((object: dataPreferences.Preferences) => { + try { + let getPromise = object.get('selectedDate', ''); + getPromise.then((data: dataPreferences.ValueType) => { + let dateSting = data as string; + if (dateSting.length > 0) { + dateModel = JSON.parse(dateSting) as DateModel; + callback(dateModel); + } else { + callback(dateModel); + } + }).catch(() => { + callback(dateModel); + }) + } catch (err) { + callback(dateModel); + } + }).catch(() => { + callback(dateModel); + }) + } catch (err) { + callback(dateModel); + } + } + + static setDate(context: Context, dateModel: DateModel, callback: () => void) { + try { + let promise = dataPreferences.getPreferences(context, 'date'); + promise.then((object: dataPreferences.Preferences) => { + try { + let setPromise = object.put('selectedDate', JSON.stringify(dateModel)); + setPromise.then(() => { + let flushPromise = object.flush(); + flushPromise.then(() => { + AppStorage.setOrCreate('selectedDate', dateModel); + callback(); + }).catch(() => { + callback(); + }) + }).catch(() => { + callback(); + }) + } catch (err) { + callback(); + } + }).catch(() => { + callback(); + }) + } catch (err) { + callback(); + } + } + + static deleteDate(context: Context, callback: () => void) { + try { + let promise = dataPreferences.getPreferences(context, 'date'); + promise.then((object: dataPreferences.Preferences) => { + try { + let deletePromise = object.delete('selectedDate'); + deletePromise.then(() => { + let flushPromise = object.flush(); + flushPromise.then(() => { + AppStorage.setOrCreate('selectedDate', undefined); + callback(); + }).catch(() => { + }) + }).catch(() => { + }) + } catch (err) { + } + }).catch(() => { + }) + } catch (err) { + } + } +} diff --git a/entry/src/main/ets/viewmodel/DateModel.ets b/entry/src/main/ets/viewmodel/DateModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ba8eea18f7d9520fc56a6c0e7aeb9a15484763e --- /dev/null +++ b/entry/src/main/ets/viewmodel/DateModel.ets @@ -0,0 +1,28 @@ +/* + * 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 DateModel { + day: number; + week: number; + month: number; + year: number; + + constructor(day: number, week: number, month: number, year: number) { + this.day = day; + this.week = week; + this.month = month; + this.year = year; + } +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/GetDate.ets b/entry/src/main/ets/viewmodel/GetDate.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc8bbd0b3f7b43472dbc1613023f32c549eda515 --- /dev/null +++ b/entry/src/main/ets/viewmodel/GetDate.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. + */ + +import { DateModel } from './DateModel'; + +export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[]{ + let currentFirstWeekDay: number = 0; + let currentLastWeekDay: number = 0; + let currentAllDay: number[] = []; + let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate(); + currentFirstWeekDay = new Date(specifiedYear, specifiedMonth - 1, 1).getDay(); + currentLastWeekDay = new Date(specifiedYear, specifiedMonth - 1, totalDays).getDay(); + for (let item = 0; item < currentFirstWeekDay; item++) { + currentAllDay[item] = 0; + } + for (let item = 1; item <= totalDays; item++) { + currentAllDay.push(item); + } + for (let item = 0; item < 6 - currentLastWeekDay; item++) { + currentAllDay.push(0); + } + return currentAllDay; +} + +export function getRealTimeDate(): DateModel{ + const nowDate = new Date(); + let currentMonth = nowDate.getMonth() + 1; + let currentDay = nowDate.getDate(); + let currentYear = nowDate.getFullYear(); + let currentWeekDay = new Date(currentYear, currentMonth - 1, currentDay).getDay(); + let nowDateModel = new DateModel(0, 0, 0, 0); + nowDateModel.day = currentDay; + nowDateModel.week = currentWeekDay; + nowDateModel.month = currentMonth; + nowDateModel.year = currentYear; + return nowDateModel; +} \ No newline at end of file diff --git a/entry/src/main/ets/viewmodel/MonthDataSource.ets b/entry/src/main/ets/viewmodel/MonthDataSource.ets new file mode 100644 index 0000000000000000000000000000000000000000..70eae89d1ddafc347acfcff7cbc71f4e7e8cd7b6 --- /dev/null +++ b/entry/src/main/ets/viewmodel/MonthDataSource.ets @@ -0,0 +1,86 @@ +/* + * 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 Month { + month: string; + num: number; + days: number[]; +} + +export class MonthDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private dataArray: Month[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): Month { + return this.dataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + public addData(index: number, data: Month): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public pushData(data: Month | Month[]): void { + if (Array.isArray(data)) { + this.dataArray.push(...data); + } else { + this.dataArray.push(data); + } + this.notifyDataAdd(this.dataArray.length - 1); + } +} diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..de78b5cae3b2ba99788048311e5d0cd34d075039 --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry", + "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, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3d6aa289f1702cbc6dd54091df4eac081506897f --- /dev/null +++ b/entry/src/main/resources/base/element/color.json @@ -0,0 +1,64 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "color_sub_background", + "value": "#f2f3f5" + }, + { + "name": "color_warning", + "value": "#0A59F7" + }, + { + "name": "color_text_primary", + "value": "#323435" + }, + { + "name": "color_text_secondary", + "value": "#afb0b1" + }, + { + "name": "color_background", + "value": "#e4e4e4" + }, + { + "name": "shadow_color", + "value": "#ededed" + }, + { + "name": "color_border", + "value": "#cccccc" + }, + { + "name": "dialog_background", + "value": "#f5f5f5" + }, + { + "name": "color_shadow", + "value": "#aaaaaa" + }, + { + "name": "color_bind_sheet", + "value": "#333333" + }, + { + "name": "color_background_bind", + "value": "#f1f1f1" + }, + { + "name": "color_linear1", + "value": "#3366FF" + }, + { + "name": "color_linear2", + "value": "#3366CC" + }, + { + "name": "color_linear3", + "value": "#336699" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..8aa1302f287c5f8f1c0d555d1eba13d9f10b413b --- /dev/null +++ b/entry/src/main/resources/base/element/float.json @@ -0,0 +1,188 @@ +{ + "float": [ + { + "name": "train_image_size", + "value": "20vp" + }, + { + "name": "check_button_height", + "value": "40vp" + }, + { + "name": "card_padding", + "value": "16vp" + }, + { + "name": "text_height", + "value": "40vp" + }, + { + "name": "month_text", + "value": "240vp" + }, + { + "name": "text_size_headline", + "value": "16vp" + }, + { + "name": "text_size_body1", + "value": "14vp" + }, + { + "name": "corner_radius_default_m", + "value": "20vp" + }, + { + "name": "corner_radius_default_l", + "value": "25vp" + }, + { + "name": "button_margin", + "value": "12vp" + }, + { + "name": "column_padding", + "value": "15vp" + }, + { + "name": "border", + "value": "2vp" + }, + { + "name": "row_height", + "value": "60vp" + }, + { + "name": "shadow_radius", + "value": "100vp" + }, + { + "name": "font_size", + "value": "20fp" + }, + { + "name": "font_size1", + "value": "16fp" + }, + { + "name": "text_margin", + "value": "10vp" + }, + { + "name": "row_padding", + "value": "30vp" + }, + { + "name": "column_margin", + "value": "-30vp" + }, + { + "name": "font_size3", + "value": "18fp" + }, + { + "name": "font_size4", + "value": "35fp" + }, + { + "name": "border_radius1", + "value": "8vp" + }, + { + "name": "font_size5", + "value": "28fp" + }, + { + "name": "bind_sheet_height", + "value": "300vp" + }, + { + "name": "builder_height", + "value": "35vp" + }, + { + "name": "corner_radius", + "value": "24vp" + }, + { + "name": "button_height1", + "value": "56vp" + }, + { + "name": "dialog_height", + "value": "110vp" + }, + { + "name": "toast_height", + "value": "36vp" + }, + { + "name": "calendar_height", + "value": "50vp" + }, + { + "name": "blank_height", + "value": "38vp" + }, + { + "name": "margin_large", + "value": "275vp" + }, + { + "name": "border_radius2", + "value": "18vp" + }, + { + "name": "toast_width", + "value": "120vp" + }, + { + "name": "bottom_margin", + "value": "90vp" + }, + { + "name": "offset_dy", + "value": "-80vp" + }, + { + "name": "margin_top", + "value": "74vp" + }, + { + "name": "border_radius3", + "value": "32vp" + }, + { + "name": "offset_x", + "value": "-50vp" + }, + { + "name": "offset_x_l", + "value": "-150vp" + }, + { + "name": "offset_y", + "value": "-180vp" + }, + { + "name": "border_radius5", + "value": "5vp" + }, + { + "name": "width_l", + "value": "320vp" + }, + { + "name": "offset_x_m", + "value": "-160vp" + }, + { + "name": "offset_y_l", + "value": "-100vp" + }, + { + "name": "offset_20", + "value": "-20vp" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8e6540bf5ab9285655dfcc47f5e5c8faff41c6f3 --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,188 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "自定义弹窗集合" + }, + { + "name": "departure", + "value": "北京" + }, + { + "name": "destination", + "value": "上海" + }, + { + "name": "check_ticket", + "value": "检查车票" + }, + { + "name": "departure_date", + "value": "出发日期" + }, + { + "name": "button_text", + "value": "仅演示,可自行实现业务功能" + }, + { + "name": "week_width", + "value": "14.3%" + }, + { + "name": "calendar_height", + "value": "90%" + }, + { + "name": "button_scroll_option1", + "value": "TimePickerDialog 12小时制" + }, + { + "name": "button_scroll_option2", + "value": "TextPickerDialog" + }, + { + "name": "index_name", + "value": "自定义弹窗合集" + }, + { + "name": "scroll_option", + "value": "滑动选择弹窗" + }, + { + "name": "select_person", + "value": "选择乘车人" + }, + { + "name": "add_person", + "value": "+ 添加乘车人" + }, + { + "name": "edit", + "value": "编辑" + }, + { + "name": "confirmed", + "value": "确认" + }, + { + "name": "confirm_order", + "value": "确认订单" + }, + { + "name": "start_time", + "value": "00:25" + }, + { + "name": "start_string", + "value": "始发站" + }, + { + "name": "car_name", + "value": "G1234" + }, + { + "name": "car_time", + "value": "8时1分" + }, + { + "name": "end_time", + "value": "08:26" + }, + { + "name": "end_name", + "value": "终点站" + }, + { + "name": "button_select", + "value": "选择乘车人" + }, + { + "name": "dialog_name", + "value": "模态弹窗" + }, + { + "name": "tastes", + "value": "口味与餐具" + }, + { + "name": "choose_flavors", + "value": "选择点餐口味和餐具" + }, + { + "name": "bind_sheet_dialog", + "value": "半模态弹窗" + }, + { + "name": "login", + "value": "登陆成功 !" + }, + { + "name": "toast_dialog", + "value": "toast弹窗" + }, + { + "name": "button_name1", + "value": "隐私弹窗" + }, + { + "name": "button_name2", + "value": "温馨提示" + }, + { + "name": "two_level_dialog", + "value": "两级半模态+全屏弹窗" + }, + { + "name": "toast_text", + "value": "《隐私政策》" + }, + { + "name": "disagree", + "value": "不同意" + }, + { + "name": "agreed", + "value": "同意" + }, + { + "name": "toast_private_dialog", + "value": "隐私协议弹窗" + }, + { + "name": "full_screen", + "value": "全屏弹窗" + }, + { + "name": "calendar_dialog", + "value": "自定义日历选择器弹窗" + }, + { + "name": "button_one", + "value": "open sheet1" + }, + { + "name": "button_two", + "value": "close sheet1" + }, + { + "name": "button_three", + "value": "open sheet2" + }, + { + "name": "button_four", + "value": "close sheet2" + }, + { + "name": "button_five", + "value": "close sheet1 sheet2" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/entry/src/main/resources/base/media/background.png differ diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/entry/src/main/resources/base/media/layered_image.json b/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/entry/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/entry/src/main/resources/base/media/startIcon.png b/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/entry/src/main/resources/base/media/startIcon.png differ diff --git a/entry/src/main/resources/base/media/train_transport_icon.png b/entry/src/main/resources/base/media/train_transport_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..44ed5a9bdbbda8701231fb067643a2f9451d03d1 Binary files /dev/null and b/entry/src/main/resources/base/media/train_transport_icon.png differ diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b36aec655a6065aecf38d1c9b59089af6877150f --- /dev/null +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,14 @@ +{ + "src": [ + "pages/Index", + "pages/BindContentCoverDemo", + "pages/BindSheet", + "pages/Toast", + "pages/Privacy", + "pages/Details", + "pages/FullScreen", + "pages/CustomCalendar", + "pages/TwoLevelPageSheet", + "pages/ScrollOption" + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1857d1cf40538e42b0dabda51fe50b13e2936f5b --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,168 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "customized pop-up window set" + }, + { + "name": "departure", + "value": "beijing" + }, + { + "name": "destination", + "value": "shanghai" + }, + { + "name": "check_ticket", + "value": "check ticket" + }, + { + "name": "departure_date", + "value": "departure date" + }, + { + "name": "button_text", + "value": "only demonstration, you can implement business functions by yourself" + }, + { + "name": "week_width", + "value": "14.3%" + }, + { + "name": "calendar_height", + "value": "90%" + }, + { + "name": "button_scroll_option1", + "value": "TimePickerDialog 12 hour clock" + }, + { + "name": "button_scroll_option2", + "value": "TextPickerDialog" + }, + { + "name": "index_name", + "value": "custom pop-up window collection" + }, + { + "name": "scroll_option", + "value": "sliding selection popup" + }, + { + "name": "select_person", + "value": "choose a rider" + }, + { + "name": "add_person", + "value": "+ add passengers" + }, + { + "name": "edit", + "value": "edit" + }, + { + "name": "confirmed", + "value": "confirm" + }, + { + "name": "confirm_order", + "value": "confirm Order" + }, + { + "name": "start_time", + "value": "00:25" + }, + { + "name": "start_string", + "value": "departure station" + }, + { + "name": "car_name", + "value": "G1234" + }, + { + "name": "car_time", + "value": "8:01" + }, + { + "name": "end_time", + "value": "08:26" + }, + { + "name": "end_name", + "value": "terminal" + }, + { + "name": "button_select", + "value": "choose a rider" + }, + { + "name": "dialog_name", + "value": "modal pop-up window" + }, + { + "name": "tastes", + "value": "taste and tableware" + }, + { + "name": "choose_flavors", + "value": "choose your ordering flavors and tableware" + }, + { + "name": "bind_sheet_dialog", + "value": "semi-modal pop-up window" + }, + { + "name": "login", + "value": "login successfully !" + }, + { + "name": "toast_dialog", + "value": "toast pop-up window" + }, + { + "name": "button_name1", + "value": "privacy popup" + }, + { + "name": "button_name2", + "value": "kind tips" + }, + { + "name": "two_level_dialog", + "value": "two-level semi-modal + full-screen pop-up window" + }, + { + "name": "toast_text", + "value": "privacy Policy" + }, + { + "name": "disagree", + "value": "disagree" + }, + { + "name": "agreed", + "value": "agree" + }, + { + "name": "toast_private_dialog", + "value": "privacy Agreement pop-up window" + }, + { + "name": "full_screen", + "value": "full screen pop-up window" + }, + { + "name": "calendar_dialog", + "value": "custom calendar picker popup" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76387159c363b59ea1e62bbe82999e56a1184899 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,168 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "自定义弹窗集合" + }, + { + "name": "departure", + "value": "北京" + }, + { + "name": "destination", + "value": "上海" + }, + { + "name": "check_ticket", + "value": "检查车票" + }, + { + "name": "departure_date", + "value": "出发日期" + }, + { + "name": "button_text", + "value": "仅演示,可自行实现业务功能" + }, + { + "name": "week_width", + "value": "14.3%" + }, + { + "name": "calendar_height", + "value": "90%" + }, + { + "name": "button_scroll_option1", + "value": "TimePickerDialog 12小时制" + }, + { + "name": "button_scroll_option2", + "value": "TextPickerDialog" + }, + { + "name": "index_name", + "value": "自定义弹窗合集" + }, + { + "name": "scroll_option", + "value": "滑动选择弹窗" + }, + { + "name": "select_person", + "value": "选择乘车人" + }, + { + "name": "add_person", + "value": "+ 添加乘车人" + }, + { + "name": "edit", + "value": "编辑" + }, + { + "name": "confirmed", + "value": "确认" + }, + { + "name": "confirm_order", + "value": "确认订单" + }, + { + "name": "start_time", + "value": "00:25" + }, + { + "name": "start_string", + "value": "始发站" + }, + { + "name": "car_name", + "value": "G1234" + }, + { + "name": "car_time", + "value": "8时1分" + }, + { + "name": "end_time", + "value": "08:26" + }, + { + "name": "end_name", + "value": "终点站" + }, + { + "name": "button_select", + "value": "选择乘车人" + }, + { + "name": "dialog_name", + "value": "模态弹窗" + }, + { + "name": "tastes", + "value": "口味与餐具" + }, + { + "name": "choose_flavors", + "value": "选择点餐口味和餐具" + }, + { + "name": "bind_sheet_dialog", + "value": "半模态弹窗" + }, + { + "name": "login", + "value": "登陆成功 !" + }, + { + "name": "toast_dialog", + "value": "toast弹窗" + }, + { + "name": "button_name1", + "value": "隐私弹窗" + }, + { + "name": "button_name2", + "value": "温馨提示" + }, + { + "name": "two_level_dialog", + "value": "两级半模态+全屏弹窗" + }, + { + "name": "toast_text", + "value": "《隐私政策》" + }, + { + "name": "disagree", + "value": "不同意" + }, + { + "name": "agreed", + "value": "同意" + }, + { + "name": "toast_private_dialog", + "value": "隐私协议弹窗" + }, + { + "name": "full_screen", + "value": "全屏弹窗" + }, + { + "name": "calendar_dialog", + "value": "自定义日历选择器弹窗" + } + ] +} \ No newline at end of file diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8c56bf6a23806e1ce92f72ed34a38613e27c494f --- /dev/null +++ b/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 */ + } +} \ No newline at end of file diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e61264cc8a53529e4f4fa5968c6282b060682351 --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,15 @@ +{ + "modelVersion": "5.0.0", + "name": "customdialoggathers", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.17", + "@ohos/hamock": "1.0.0" + } +} \ No newline at end of file diff --git a/screenshots/device/custom.gif b/screenshots/device/custom.gif new file mode 100644 index 0000000000000000000000000000000000000000..4c830a0c97673d123c58c16e1adbbf0fa5ad6c29 Binary files /dev/null and b/screenshots/device/custom.gif differ