diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fdc0c4a65db238be4186f16e1e0911b1d61fbf31 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +/entry/.preview +.cxx +/node_modules diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d0381d6d04c77c78c42ae875f97d38483ba0c636 --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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 diff --git a/README.md b/README.md index 006a3964bfe1730548c45ac908d4e022fe41de6a..071376ef15e4593a09fcacf1207266516febe41c 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,2 @@ -# applications_note +# ohos_notes -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -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/) diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6355c70fb6d781aa29c9ab2d8e07dd4fe2e8d3fc --- /dev/null +++ b/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + supportSystem "standard" +} + +buildscript { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + allowInsecureProtocol = true + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + allowInsecureProtocol = true + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.6.4' + classpath 'com.huawei.ohos:decctest:1.2.7.2' + } +} + +allprojects { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + allowInsecureProtocol = true + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + allowInsecureProtocol = true + } + } +} diff --git a/common/component/build.gradle b/common/component/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..17f0e439e73b199759d92f803b01e03644ce91d3 --- /dev/null +++ b/common/component/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.library' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + defaultConfig { + compatibleSdkVersion 8 + } + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { +} diff --git a/common/component/proguard-rules.pro b/common/component/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/common/component/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/common/component/src/main/config.json b/common/component/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..fa515b0725fc39f4bfa8be8a68adaedc86b6fc26 --- /dev/null +++ b/common/component/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.note", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.note.common", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "component", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/common/component/src/main/ets/default/CusDialogComp.ets b/common/component/src/main/ets/default/CusDialogComp.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6e902936535965b232e7e12aced0b3f4f48df37 --- /dev/null +++ b/common/component/src/main/ets/default/CusDialogComp.ets @@ -0,0 +1,531 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {circleColorArray,fontColorArray} from '../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' +import {SysDefFolderUuid, DeleteFileType, FolderType} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import GlobalResourceManager from '../../../../../../common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets'; +import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' +import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' + +@CustomDialog +export struct NewOrEditFolderDialog { + newOrEditFolderDialogCtl: CustomDialogController; + confirm: (color: string, name: string) => void + @State inputName: string = ""; + private oriInputName: string = ""; + private oriSelectedColor: string = ""; + private editFolderUuid: string = ""; + private dialogType: number = 0; // 0表示新建文件夹 1表示修改文件夹 + @State isExisted: boolean = false; + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @Consume('SelectedColor') selectedColor: string; + + build() { + Column() { + Text(this.dialogType == 0 ? $r("app.string.createFolder") : $r("app.string.editFolder")) + .fontSize(20).height(56).margin({ left: 24 }) + // folder color choose + Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + ForEach(circleColorArray, (colorStr: string) => { + ColorCircleComp({ circleColor: colorStr }) + }, colorStr => colorStr) + }.margin({ bottom: 24, left: 24, right: 24 }) + // folder name input + Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + Image($r("app.media.folder")) + .width(24) + .height(24) + .objectFit(ImageFit.ScaleDown) + .fillColor(this.selectedColor) + TextInput({ text: this.inputName, placeholder: $r("app.string.input_placeholder") }) + .placeholderFont({ size: 18 }) + .maxLength(20) + .borderRadius(15) + .backgroundColor(Color.White) + .width('90%') + .onChange((value: string) => { + this.inputName = value + FolderUtil.duplicateDetection(this.inputName, this.AllFolderArray).then(result => { + this.isExisted = result + }) + }) + }.margin({ bottom: 4, left: 24, right: 24 }) + + Text($r("app.string.category_already_exist")).fontSize(10).margin({ left: 64 }).fontColor("#FA2A2D") + .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) + // button group + Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { + Text($r("app.string.cancel")) + .fontSize(18) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.button_color_f86d05")) + .width('48%') + .onClick(() => { + this.newOrEditFolderDialogCtl.close() + }) + Divider().vertical(true).height(15).strokeWidth(1).color($r("app.color.divider_color_e4e4e4")) + Text($r("app.string.save")) + .opacity(this.inputName == "" + || (this.oriSelectedColor == this.selectedColor && this.inputName == this.oriInputName && this.dialogType == 1) + || (this.isExisted && this.dialogType == 0) + || (this.isExisted && this.dialogType == 1 && this.inputName != this.oriInputName) ? 0.4 : 1) + .enabled(this.inputName == "" + || (this.oriSelectedColor == this.selectedColor && this.inputName == this.oriInputName && this.dialogType == 1) + || (this.isExisted && this.dialogType == 0) + || (this.isExisted && this.dialogType == 1 && this.inputName != this.oriInputName) ? false : true) + .fontSize(18) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.button_color_f86d05")) + .width('48%') + .onClick(() => { + this.newOrEditFolderDialogCtl.close() + this.confirm(this.selectedColor, this.inputName) + }) + }.width('100%').margin({ top: 21, bottom: 25 }) + } + .width(336) + .borderRadius(36) + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .margin({bottom:16,left:12,right:12}) + } + + aboutToAppear(): void{ + var currentFolder: FolderData = FolderUtil.getFolderData(this.AllFolderArray, this.editFolderUuid) // 获取当前选中的文件夹 + if (currentFolder == null) { + return + } + if (currentFolder.folder_type == FolderType.CusDef) { + this.inputName = currentFolder.name + this.oriInputName = this.inputName + this.oriSelectedColor = currentFolder.color + } else { + GlobalResourceManager.getStringByResource(FolderUtil.getFolderText(currentFolder)).then(result => { + this.inputName = result + this.oriInputName = this.inputName + this.oriSelectedColor = currentFolder.color + }) + } + } +} + +@Component +struct ColorCircleComp { + private circleColor: string + @Consume('SelectedColor') selectedColor: string; + + build() { + Stack({ alignContent: Alignment.Center }) { + Circle({ width: 24, height: 24 }).fill(this.circleColor) + Circle({ width: 12, height: 12 }).fill($r("app.color.color_ffffff")) + .visibility(this.circleColor == this.selectedColor ? Visibility.Visible : Visibility.None) + }.onClick(() => { + this.selectedColor = this.circleColor + }) + } +} + +@CustomDialog +export struct DeleteDialog { + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('SelectedFolderData') selectedFolderData: FolderData + private multiSelect: boolean = false + private deleteFileType = DeleteFileType.NoteData + noteDataDeleteDialogCtl: CustomDialogController + onConfirm: () => void + + build() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + if (this.deleteFileType == DeleteFileType.FolderData) { + Text($r("app.string.delete_tips")).fontSize(14).textAlign(TextAlign.Center).maxLines(1) + } else { + Text(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? $r("app.string.deleteNoteComplete") : $r("app.string.deleteNote")) + .fontSize(14).textAlign(TextAlign.Center).maxLines(1) + .visibility(this.multiSelect == false || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None) + if (this.CheckedNoteArray.length == + NoteUtil.getNoteDataArray(this.AllNoteArray, this.selectedFolderData.uuid).length) { + Text($r("app.string.deleteAllNote")) + .fontSize(14).textAlign(TextAlign.Center).maxLines(1) + .visibility(this.multiSelect == false || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + } else if (this.CheckedNoteArray.length == 1) { + Text($r("app.string.deleteNote")) + .fontSize(14).textAlign(TextAlign.Center).maxLines(1) + .visibility(this.multiSelect == false || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + } else { + Text($r("app.string.deletePartNote", this.CheckedNoteArray.length)) + .fontSize(14).textAlign(TextAlign.Center).maxLines(1) + .visibility(this.multiSelect == false || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + } + } + } + .width(288) + .height(28.5) + + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text($r("app.string.cancel")) + .fontSize(16) + .fontColor($r("app.color.button_color_f86d05")) + .textAlign(TextAlign.Center) + .maxLines(1) + .width('50%') + .height('100%') + .onClick(() => { + this.noteDataDeleteDialogCtl.close() + }) + Divider().vertical(true).strokeWidth(1).color($r("app.color.divider_color_e4e4e4")).height(40) + Text($r("app.string.delete")) + .fontSize(16) + .fontColor($r("app.color.delete_color_fa2a2d")) + .textAlign(TextAlign.Center) + .maxLines(1) + .width('50%') + .height('100%') + .onClick(() => { + this.noteDataDeleteDialogCtl.close() + this.onConfirm() + }) + } + .width('100%') + .height('50%') + } + .width(336) + .height(117) + .borderRadius(36) + .padding({ top: 24, bottom: 16, left: 16, right: 16 }) + .backgroundColor(Color.White) + .margin({bottom:16,left:12,right:12}) + } +} + +@Component +struct NoteDataMoveItemComp { + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + private folderItem: FolderData + + build() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) { + Image(FolderUtil.getFolderIcon(this.folderItem.uuid)) + .objectFit(ImageFit.ScaleDown) + .width(24) + .height(24) + .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) + } + .width(24) + + Column() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + Text(FolderUtil.getFolderText(this.folderItem)) + .fontSize(16) + .textAlign(TextAlign.Center) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .flexShrink(1) + Image((FolderUtil.getCommonFolder(this.AllFolderArray, this.CheckedNoteArray) == null + || FolderUtil.getCommonFolder(this.AllFolderArray, this.CheckedNoteArray) != this.folderItem) ? $r("app.media.foldMove_unselect") : $r("app.media.foldMove_select")) + .objectFit(ImageFit.ScaleDown) + .width(24) + .height(24) + } + .width(248) + .height(55) + + Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1) + } + .padding({ left: 16 }) + } + .width(288) + .height(56) + .visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None) + } +} + +@CustomDialog +export struct NoteDataMoveDialog { + noteDataMoveDialogCtl: CustomDialogController + onConfirm: (folderUuid: string) => void + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) { + Flex({ alignItems: ItemAlign.Center }) { + Text($r("app.string.chooseFolder")) + .fontSize(20) + }.height(56).width(288) + + List() { + ForEach(this.AllFolderArray, (item) => { + ListItem() { + NoteDataMoveItemComp({ folderItem: item }) + } + .onClick(() => { + this.noteDataMoveDialogCtl.close() + this.onConfirm(item.uuid) + }) + }, noteItem => noteItem.uuid) + }.listDirection(Axis.Vertical) + .edgeEffect(EdgeEffect.Spring) + .height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56) + + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text($r("app.string.cancel")) + .fontSize(16) + .fontColor($r("app.color.text_color_3f97e9")) + .onClick(() => { + this.noteDataMoveDialogCtl.close() + }) + }.height(56).width(288) + } + .width(336) + .borderRadius(36) + .height(this.AllFolderArray.length > 12 ? 616 : (this.AllFolderArray.length - 1) * 56) + .padding({ left: 24, right: 24 }) + .backgroundColor(Color.White) + .margin({bottom:16,left:12,right:12}) + } +} + +@CustomDialog +export struct EditContentDialog { + editContentDialogCtl: CustomDialogController; + confirm: (excuteJs: string) => void + @Consume('SelectedColor') selectedColor: string; + @State inSetValue: number = 20 + private circleColor: string + private fontSize:number + + build() { + Row() { + Column() { + Row({ space: 70 }) { + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.action_bold')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setBold()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.format_italic')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setItalic()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.underline')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setUnderline()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.right_justify')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setJustifyRight()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.mid_justify')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setJustifyCenter()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.left_justify')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setJustifyLeft()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + } + .alignItems(VerticalAlign.Bottom) + .padding({bottom:2}) + .height(71) + + Divider().vertical(false).color($r("app.color.divider_color_e4e4e4")) + + Row({ space: 70 }){ + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.suojin')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setIndent()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.suojin_back')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setOutdent()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r("app.media.format_menulist_number")).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setNumbers()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r("app.media.format_menulist_alphabet")).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setABC()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.format_menubullte2')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setBullets()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.format_menubullte1')).height(24).width(24) + .onClick(() => { + this.confirm("javascript:RE.setSquare()") + }) + }.width(42).height(42).borderRadius(8).backgroundColor($r('app.color.color_ffffff')) + } + .alignItems(VerticalAlign.Top) + .padding({top:2}) + .height(56) + } + .width('50%') + .padding({left:24,right:24}) + .height(128) + + Divider().vertical(true).height(128).color($r("app.color.divider_color_e4e4e4")).margin({top:4,bottom:4}) + + Column() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.End }) { + Image($r('app.media.cross')).height(16).width(16).margin({top:8}) + .onClick(() => { + this.editContentDialogCtl.close() + }) + } + .height(36) + Row(){ + Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + ForEach(fontColorArray, (colorStr: string) => { + Stack({ alignContent: Alignment.Center }) { + Circle({ width: 24, height: 24 }).fill(colorStr) + Circle({ width: 12, height: 12 }).fill($r("app.color.color_ffffff")) + .visibility(colorStr == this.selectedColor ? Visibility.Visible : Visibility.None) + }.onClick(() => { + this.selectedColor = colorStr + this.confirm("javascript:RE.setTextColor('" + this.selectedColor + "')") + }) + }, colorStr => colorStr) + }.padding({ bottom: 11}) + } + .alignItems(VerticalAlign.Top) + .height(35) + + Divider().vertical(false).color($r("app.color.divider_color_e4e4e4")) + + Row({ space: 15 }) { + Image($r('app.media.font_small')).height(24).width(24).margin({top:8}) + Slider({ + value: this.inSetValue, + min: 0, + max: 60, + step: 10, + style: SliderStyle.InSet + }) + .blockColor($r("app.color.color_ffffff")) + .trackColor($r("app.color.divider_color_e4e4e4")) + .selectedColor($r("app.color.text_color_f86d05")) + .showSteps(false) + .showTips(false) + .onChange((value: number, mode: SliderChangeMode) => { + this.inSetValue = value + this.fontSize = value + 20 + this.confirm("javascript:RE.execFontSize('" + this.fontSize+"')") + console.info('value:' + value + 'mode:' + mode.toString()) + }) + .width('88%') + Image($r('app.media.font_large')).height(24).width(24).margin({top:7}) + } + .alignItems(VerticalAlign.Top) + .padding({ top: 5 }) + .height(56) + } + .width('50%') + .height(128) + .padding({left:24,right:24}) + } + .width('100%') + .height(128) + .backgroundColor($r("app.color.color_ffffff")) + .borderRadius(36) + } +} + +@CustomDialog +export struct EditTitleDialog { + editTitleDialog: CustomDialogController; + confirm: (newTitle: string) => void + @State inputName: string = ""; + + build() { + Column() { + Text($r("app.string.editNoteTitle")).fontSize(20).height(56).margin({ left: 24 }) + + // title input + Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + TextInput({ text: this.inputName, placeholder: $r("app.string.input_placeholder") }) + .placeholderFont({ size: 18 }) + .maxLength(20) + .borderRadius(15) + .backgroundColor(Color.White) + .width('90%') + .onChange((value: string) => { + this.inputName = value + }) + }.margin({ bottom: 4, left: 24, right: 24 }) + + + // button group + Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { + Text($r("app.string.cancel")) + .fontSize(18) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.button_color_419fff")) + .width('48%') + .onClick(() => { + this.editTitleDialog.close() + }) + Divider().vertical(true).height(15).strokeWidth(1).color($r("app.color.divider_color_e4e4e4")) + Text($r("app.string.save")) + .opacity((this.inputName == "") ? 0.4 : 1) + .enabled((this.inputName == "") ? false : true) + .fontSize(18) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.button_color_419fff")) + .width('48%') + .onClick(() => { + this.editTitleDialog.close() + this.confirm(this.inputName) + }) + }.width('100%').margin({ top: 21, bottom: 25 }) + } + .width(336) + .borderRadius(36) + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .margin({bottom:16,left:12,right:12}) + } +} \ No newline at end of file diff --git a/common/component/src/main/ets/default/FolderListComp.ets b/common/component/src/main/ets/default/FolderListComp.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c238063d0af28921fcdbcee912202261681c4b0 --- /dev/null +++ b/common/component/src/main/ets/default/FolderListComp.ets @@ -0,0 +1,354 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {SysDefFolderUuid, TableName, FolderType, FolderTableColumn, NoteTableColumn, Delete, DeleteFileType +} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import {NewOrEditFolderDialog, DeleteDialog} from './CusDialogComp.ets' +import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' +import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' +import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' + +// Folder list component +@Component +export struct FolderListComp { + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @Consume('SectionStatus') sectionStatus: number + @Consume('ExpandStatus') expandStatus: boolean //笔记本折叠展开状态 + controllerShow: WebController + + build() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Column() { + Column() { + Image($r("app.media.suojin")).height(24).width(24) + .onClick(() => { + if (this.sectionStatus == 1) { + this.expandStatus = !this.expandStatus + } else{ + this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) + // 迁移 + console.log("FolderListComp, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + console.log("FolderListComp, set continue section success") + } + }) + }.alignItems(HorizontalAlign.Start) + .width("100%").margin({ top: 28 }).padding({ left: 24 }) + + NoteAndCreateComp() + // center + Column() { + List() { + ForEach(this.AllFolderArray, (folderItem: FolderData) => { + ListItem() { + if (!FolderUtil.isBottomFixedFolder(folderItem)) { + FolderItemComp({ folderItem: folderItem,controllerShow: this.controllerShow}) + } + } + }, folderItem => folderItem.name.toString()) + } + }.width('100%').padding({ left: 12, right: 12 }).height(7 * 56) // 列表最多显示7个 每个的高度为56 + } + + Column() { + FolderItemComp({ + folderItem: FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), SysDefFolderUuid.MyFavorites),controllerShow: this.controllerShow + }) + FolderItemComp({ + folderItem: FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), SysDefFolderUuid.RecentDeletes),controllerShow: this.controllerShow + }) + }.margin({ bottom: 48 }).width("100%").padding({ left: 12, right: 12 }) + } + } +} + +@Component +export struct NoteAndCreateComp { + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @Consume('SelectedColor') selectedColor: string; + @Consume('PortraitModel') portraitModel:boolean + + folderCreateDialogCtl: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + + folderCreateDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) + + onCreateConfirm(color:string, name:string) { + let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1 + this.AllFolderArray.push(folderData) + // insert folder to db + RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null) + } + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Row() { + Text($r("app.string.note")) + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.width(102) + + Row() { + Text($r("app.string.create")) + .fontSize(14) + .fontColor($r("app.color.text_color_f86d05")) + .onClick(() => { + this.selectedColor = "#e84026" // 新建的时候选中第一个颜色 + if(this.portraitModel) { + this.folderCreateDialogCtlBottom.open() + }else{ + this.folderCreateDialogCtl.open() + } + }).padding({ right: 0 }) + }.width(50) + }.width("100%").margin({ top: 8 }).padding({ left: 24 }).height(56) + } +} + +@Component +struct FolderItemComp { + @State folderItem: FolderData = undefined + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = [] + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('RefreshFlag') refreshFlag: number + @Consume('Longpress') longpress: boolean + @Consume('SelectedColor') selectedColor: string; + @Consume('PortraitModel') portraitModel:boolean + controllerShow: WebController + + private isLongPress: boolean = false + TAG = "FolderListComp" +// Folder Edit Dialog + folderEditDialogCtl: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ + editFolderUuid: this.folderItem.uuid, + confirm: this.onEditConfirm.bind(this), + dialogType: 1 + }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) +// Folder Edit Dialog for portrait model + folderEditDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ + editFolderUuid: this.folderItem.uuid, + confirm: this.onEditConfirm.bind(this), + dialogType: 1 + }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) +// Folder Edit Callback + onEditConfirm(color:string, name:string) { + this.folderItem.color = color + this.folderItem.name = name + this.folderItem.folder_type = FolderType.CusDef + // update folder to db + let predicates_folder = RdbStoreUtil.getRdbPredicates(TableName.FolderTable) + predicates_folder.equalTo(FolderTableColumn.Uuid, this.folderItem.uuid) + RdbStoreUtil.update(this.folderItem.toFolderObject(), predicates_folder, null) + } +// Folder Delete Dialog + folderDeleteDialogCtl: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), deleteFileType: DeleteFileType.FolderData }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) +// Folder Delete Dialog for portrait model + folderDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), deleteFileType: DeleteFileType.FolderData }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) +// Folder Delete Callback + onDeleteConfirm() { + let currentFolder = FolderUtil.getFolderData(this.AllFolderArray, this.folderItem.uuid) + let index = this.AllFolderArray.indexOf(currentFolder) + let currentNoteDataArray = NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.folderItem.uuid) + if (index > -1) { + this.AllFolderArray.splice(index, 1) + currentNoteDataArray.forEach((noteItem: NoteData) => { + noteItem.is_deleted = Delete.Yes + noteItem.folder_uuid = SysDefFolderUuid.UnClassified + noteItem.deleted_time = new Date().getTime() + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + // delete folder from db + let predicates_folder = RdbStoreUtil.getRdbPredicates(TableName.FolderTable) + predicates_folder.equalTo(FolderTableColumn.Uuid, this.folderItem.uuid) + RdbStoreUtil.delete(predicates_folder, null) + } + } +// Folder Create Dialog + folderCreateDialogCtl: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) +// Folder Create Dialog for portrait model + folderCreateDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) +// Folder Create Callback + onCreateConfirm(color:string, name:string) { + let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1 + this.AllFolderArray.push(folderData) + // insert folder to db + RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null) + } + + @Builder menuBuilder() { + Column({space: 1}) { + Text($r("app.string.editFolder")) + .width(124).height(48).padding({top:13, bottom: 13}) + .fontSize(16).fontColor($r("app.color.folder_color_182431")) + .onClick(() => { + this.selectedColor = this.folderItem.color; + if (this.portraitModel) { + this.folderEditDialogCtlBottom.open() + } else { + this.folderEditDialogCtl.open() + } + ContextMenu.close(); + }) + Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1) + Text($r("app.string.deleteFolder")) + .width(124).height(48).padding({top:13, bottom: 14}) + .fontSize(16).fontColor($r("app.color.folder_color_182431")) + .onClick(() => { + if(this.portraitModel) { + this.folderDeleteDialogCtlBottom.open() + }else{ + this.folderDeleteDialogCtl.open() + } + ContextMenu.close(); + }) + Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1) + Text($r("app.string.createFolder")) + .width(124).height(48).padding({top:13, bottom: 15}) + .fontSize(16).fontColor($r("app.color.folder_color_182431")) + .onClick(() => { + this.selectedColor = "#e84026" // 新建的时候选中第一个颜色 + if(this.portraitModel) { + this.folderCreateDialogCtlBottom.open() + }else{ + this.folderCreateDialogCtl.open() + } + ContextMenu.close(); + }) + }.width(156).height(154).padding({top: 4, bottom: 4, left: 16, right: 16}).borderRadius(16).backgroundColor(Color.White) + .visibility(this.folderItem.folder_type == FolderType.CusDef ? Visibility.Visible : Visibility.None) + } + + build() { + Flex() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + Row() { + Image(FolderUtil.getFolderIcon(this.folderItem.uuid)) + .objectFit(ImageFit.ScaleDown) + .width(24) + .height(24) + .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid)) + .margin({ right: 16 }) + Text(FolderUtil.getFolderText(this.folderItem)) + .fontSize(16) + .textAlign(TextAlign.Center) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .flexShrink(1) + .fontColor(FolderUtil.getFolderTextColor(this.selectedFolderData.uuid == this.folderItem.uuid)) + Text(this.refreshFlag.toString()).visibility(Visibility.None) // 用于强制刷新使用 + }.width(118) + + Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.folderItem.uuid).toString()) + .fontSize(14) + .textAlign(TextAlign.Center) + } + .width('100%') + .borderRadius(12) + .height(56) + .padding({ left: 12, right: 12 }) + .backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") : this.selectedFolderData.uuid == this.folderItem.uuid + ? $r("app.color.folder_color_ffffff") : $r("app.color.folder_color_19ffffff")) + .bindContextMenu(this.menuBuilder, ResponseType.LongPress) + .bindContextMenu(this.menuBuilder, ResponseType.RightClick) + .onClick(() => { + if (this.longpress) { + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + } else { + this.selectedFolderData = this.folderItem + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.folderItem.uuid) + // 刷新web界面 + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + // 迁移 + console.log("FolderItemComp, set continue folder and note") + + let continueFolder: string = JSON.stringify(this.selectedFolderData.toFolderObject()) + console.log("FolderItemComp, continueFolder : " + continueFolder) + + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("FolderItemComp, continueNote : " + continueNote) + + AppStorage.SetOrCreate('ContinueFolder', continueFolder) + AppStorage.SetOrCreate('ContinueNote', continueNote) + AppStorage.SetOrCreate('ContinueSection', 3) + console.log("FolderItemComp, set continue folder and note success") + } + }) + } + .width('100%') + .height(56) + .parallelGesture( + GestureGroup(GestureMode.Exclusive, + LongPressGesture() + .onAction(() => { + this.isLongPress = true + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + .onActionEnd(() => { + this.isLongPress = false + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + ) + ) + } +} \ No newline at end of file diff --git a/common/component/src/main/ets/default/NoteContentComp.ets b/common/component/src/main/ets/default/NoteContentComp.ets new file mode 100644 index 0000000000000000000000000000000000000000..037c2a6224688a19c9f640c3e8b73d5cf0e40351 --- /dev/null +++ b/common/component/src/main/ets/default/NoteContentComp.ets @@ -0,0 +1,541 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/DateUtil.ets' +import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' +import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete +} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import {EditContentDialog,DeleteDialog,EditTitleDialog} from './CusDialogComp.ets' +import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' +import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' +import prompt from '@system.prompt' +import featureAbility from '@ohos.ability.featureAbility'; +import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' + +const TAG = "NoteContentComp" + +// Note content component +@Component +export struct NoteContentComp { + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('EditModel') editModel:boolean + @Consume('SectionStatus') sectionStatus: number + @Consume('LastSectionStatus') lastSectionStatus: number + controllerShow: WebController + private editContentFlag = false + @State uri1 : string = ""; + private context = getContext(this) + + noteContent = { + callbackhtml: (html) => { + LogUtil.info(TAG, 'html content is:' + html) + LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid) + this.selectedNoteData.content_text = html + this.selectedNoteData.modified_time = new Date().getTime() + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + LogUtil.info(TAG, 'update note success:' + this.selectedNoteData) + // 删除空白笔记 + NoteUtil.deleteEmptyNote(this.selectedNoteData,this.AllNoteArray,this.controllerShow) + return "AceString"; + } + } + + build() { + Stack({ alignContent: Alignment.Bottom }) { + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, + alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) { + Column() { + ToolBarComp({controllerShow: this.controllerShow}) + } + + Column() { + NoteContentOverViewComp() + Text(this.refreshFlag.toString()).visibility(Visibility.None) + Text(this.AllNoteArray.length.toString()).visibility(Visibility.None) // 用于强制刷新使用 + + Web({ src: $rawfile('editor.html'), controller: this.controllerShow }) + .javaScriptAccess(true) + .onPageEnd((e) => { + if (this.editContentFlag == false) { + this.controllerShow.registerJavaScriptProxy({ + obj: this.noteContent, + name: "callBackToApp", // html--> name.method + methodList: ["callbackhtml"], + }); + LogUtil.info(TAG, "finish register") + this.controllerShow.refresh() + this.editContentFlag = true + } + LogUtil.info(TAG, "finish loadurl") + console.log('onPageEnd:' + e.url) + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + // 初次加载为为小屏预览模式 + if(this.sectionStatus != 1) { + this.controllerShow.runJavaScript({script:"RE.setInputEnabled(false)"}) + } + }) + .zoomAccess(false) + .height(450) + .width('100%') + } + .margin({ top: 16 }).width(StyleConstants.PERCENTAGE_100) + .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) + .enabled(this.selectedNoteData.is_deleted == Delete.Yes ? false : true) + .onClick(() => { + // 点击第三屏进入全屏编辑模式 + if(this.sectionStatus != 1) { + this.lastSectionStatus = this.sectionStatus + this.sectionStatus = 1 + this.controllerShow.runJavaScript({script:"RE.setInputEnabled(true)"}) + this.editModel = !this.editModel + } + }) + } + .height(StyleConstants.PERCENTAGE_100) + .margin({ left: 24, right: 24 }) + .visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible) + + DeleteNoteComp() + } + .height(StyleConstants.PERCENTAGE_100) + .width(StyleConstants.PERCENTAGE_100) + } +} + +@Component +export struct NoteContentOverViewComp { + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @Consume('EditModel') editModel:boolean + @Consume('SectionStatus') sectionStatus: number + + editTitleDialogCtl: CustomDialogController = new CustomDialogController({ + builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + + confirm(newTitle: string) { + this.selectedNoteData.title = newTitle + this.selectedNoteData.modified_time = new Date().getTime() + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + } + + @Builder MenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + List() { + ForEach(this.AllFolderArray, (item) => { + ListItem() { + NoteDataMoveItemComp({ folderItem: item }) + } + .onClick(() => { + this.selectedNoteData.folder_uuid = item.uuid + }) + }, noteItem => noteItem.uuid) + }.listDirection(Axis.Vertical) + .edgeEffect(EdgeEffect.Spring) + .height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56) + } + .width(148) + .backgroundColor($r("app.color.color_fffffB")) + .padding({left:24,right:24}) + } + + build() { + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, + justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Row() { + Text(this.selectedNoteData.title).fontSize(30) + .onClick(() => { + this.editModel = true + this.sectionStatus = 1 + this.editTitleDialogCtl.open() + }) + }.height(40).width(StyleConstants.PERCENTAGE_100) + + Row() { + Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))).fontSize(12) + .padding({ top: 4, bottom: 4 }) + Row() { + Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) + .fontSize(12) + Image($r('app.media.triangle')) + .width(6) + .height(12) + .margin({ left: 4 }) + } + .padding({ left: 8, right: 8, top: 4, bottom: 4 }) + .margin({ left: 8 }) + .borderRadius(16) + .backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid, SysDefFolderUuid.AllNotes, false)) + .bindMenu(this.MenuBuilder) + }.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100) + } + .width(StyleConstants.PERCENTAGE_100) + .height(80) + } +} + +@Component +export struct ToolBarComp { + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('RefreshFlag') refreshFlag: number + @Consume('SectionStatus') sectionStatus: number + @Consume('LastSectionStatus') lastSectionStatus: number + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('ChooseNote') chooseNote: boolean + @Consume('PortraitModel') portraitModel: boolean + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('EditModel') editModel:boolean + controllerShow: WebController + private context = getContext(this) + +//private lastSectionStatus: number + noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) + + onDeleteConfirm() { + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + this.selectedNoteData.is_deleted = Delete.Yes + this.selectedNoteData.deleted_time = new Date().getTime() + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + } else { + NoteUtil.removeNoteData(this.AllNoteArray, this.selectedNoteData.uuid) + // delete note from db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.delete(predicates_note, null) + } + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + this.chooseNote = false + // 迁移 + console.log("ToolBarComp, onDeleteConfirm, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("ToolBarComp, onDeleteConfirm, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("ToolBarComp, onDeleteConfirm, set continue note success") + } + + editContentDialogCtl: CustomDialogController = new CustomDialogController({ + builder: EditContentDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Bottom, + autoCancel: true, + customStyle: true, + }) + + confirm(excuteJs: string) { + prompt.showToast({ message: excuteJs, duration: 2000 }) + this.controllerShow.runJavaScript({script:excuteJs}) + } + + + build() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, + justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + if (this.portraitModel == true) { + Image($r('app.media.back')).height(24).width(24) + .onClick(() => { + this.chooseNote = false + }) + } else { + Image($r('app.media.zoom')).height(24).width(24) + .onClick(() => { + if (this.sectionStatus != 1) { + this.lastSectionStatus = this.sectionStatus + this.sectionStatus = 1 + this.controllerShow.runJavaScript({script:"RE.setInputEnabled(true)"}) + } else { + if (this.lastSectionStatus != undefined) { + this.sectionStatus = this.lastSectionStatus + // 切换为小屏预览模式 + this.controllerShow.runJavaScript({script:"RE.setInputEnabled(false)"}) + // 退出全屏时存库 + LogUtil.info(TAG, "close note"+ this.selectedNoteData.uuid) + this.controllerShow.runJavaScript({script:"get_html_content()"}) + } else { + this.sectionStatus = 3 + } + } + this.editModel = !this.editModel + // 迁移 + console.log("ToolBarComp, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + console.log("ToolBarComp, set continue section success") + }) + .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) + } + + if (this.selectedNoteData.is_deleted == Delete.Yes) { + Row({ space: StyleConstants.SPACE_24 }) { + Image($r('app.media.delete')).height(24).width(24) + .onClick(() => { + this.noteDataDeleteDialogCtl.open() + }) + Image($r('app.media.recover')).height(24).width(24) + .onClick(() => { + this.selectedNoteData.is_deleted = Delete.No + this.selectedNoteData.deleted_time = 0 + prompt.showToast({ message: "已恢复", duration: 2000 }) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.chooseNote = false + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + }) + }.width(72) + .visibility(this.portraitModel ? Visibility.None : Visibility.Visible) + } else if(this.portraitModel == true && this.editModel == true) { + Row({ space: StyleConstants.SPACE_24 }) { + Image($r('app.media.undo')).height(24).width(24) + .onClick(() => { + this.controllerShow.runJavaScript({script:"javascript:RE.undo()"}) + }) + Image($r('app.media.todo')).height(24).width(24) + .onClick(() => { + this.controllerShow.runJavaScript({script:"javascript:RE.redo()"}) + }) + Image($r('app.media.tick_thin')).height(24).width(24) + .onClick(() => { + // 保存笔记信息到数据库 + this.controllerShow.runJavaScript({script:"get_html_content()"}) + }) + }.width(120) + } else if(this.editModel == true) { + Row({ space: StyleConstants.SPACE_24 }) { + Image($r('app.media.circle_tick1')).height(24).width(24) + .onClick(() => { + // 清单 + this.controllerShow.runJavaScript({script:"javascript:RE.setTodo()"}) + }) + Image($r('app.media.styles')).height(24).width(24) + .onClick(() => { + if(this.portraitModel) { + this.editContentDialogCtl.open() + }else{ + this.editContentDialogCtl.open() + } + }) + Image($r('app.media.picture_white')).height(24).width(24) + .onClick(() => { + console.info('test select single select!') + this.controllerShow.runJavaScript({script:"javascript:RE.insertImage()"}) + }) + Image($r('app.media.tick_thick')).height(24).width(24) + .onClick(() => { + // 保存笔记信息到数据库 + this.controllerShow.runJavaScript({script:"get_html_content()"}) + }) + Image($r('app.media.undo')).height(24).width(24) + .onClick(() => { + + this.controllerShow.runJavaScript({script:"RE.undo()"}) + }) + Image($r('app.media.todo')).height(24).width(24) + .onClick(() => { + this.controllerShow.runJavaScript({script:"RE.redo()"}) + }) + }.width(268) + } else { + Row({ space: StyleConstants.SPACE_24 }) { + Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') : $r('app.media.favorite_cancel')) + .height(24).width(24) + .onClick(() => { + this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) { + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites) + // 迁移 + console.log("ToolBarComp, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("ToolBarComp, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("ToolBarComp, set continue note success") + } + }) + Image($r('app.media.delete')).height(24).width(24) + .onClick(() => { + if (this.portraitModel) { + this.noteDataDeleteDialogCtlBottom.open() + } else { + this.noteDataDeleteDialogCtl.open() + } + }) + }.width(72) + } + } + .width(StyleConstants.PERCENTAGE_100) + .height(80) + } +} + +@Component +export struct DeleteNoteComp { + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('PortraitModel') portraitModel: boolean + @Consume('ChooseNote') chooseNote: boolean + noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) + + onDeleteConfirm() { + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + this.selectedNoteData.is_deleted = Delete.Yes + this.selectedNoteData.deleted_time = new Date().getTime() + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + } else { + NoteUtil.removeNoteData(this.AllNoteArray, this.selectedNoteData.uuid) + // delete note from db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.delete(predicates_note, null) + } + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + this.chooseNote = false + // 迁移 + console.log("DeleteNoteComp, onDeleteConfirm, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("DeleteNoteComp, onDeleteConfirm, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("DeleteNoteComp, onDeleteConfirm, set continue note success") + } + + build() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Image($r('app.media.delete')) + .width(24) + .height(24) + .onClick(() => { + this.noteDataDeleteDialogCtlBottom.open() + }) + Text($r("app.string.delete")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .alignItems(HorizontalAlign.Center) + + Column() { + Image($r('app.media.recover')) + .width(24) + .height(24) + .onClick(() => { + this.selectedNoteData.is_deleted = Delete.No + this.selectedNoteData.deleted_time = 0 + prompt.showToast({ message: "已恢复", duration: 2000 }) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.chooseNote = false + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + }) + Text($r("app.string.recover")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .alignItems(HorizontalAlign.Center) + } + .width(360) + .height(56) + .visibility(this.selectedNoteData.is_deleted == Delete.Yes && this.portraitModel == true ? + Visibility.Visible : Visibility.None) + } +} + +@Component +struct NoteDataMoveItemComp { + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + private folderItem: FolderData + + build() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap,justifyContent: FlexAlign.Center }) { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) { + Image(FolderUtil.getFolderIcon(this.folderItem.uuid)) + .objectFit(ImageFit.ScaleDown) + .width(24) + .height(24) + .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) + } + .width(24) + + Column() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + Text(FolderUtil.getFolderText(this.folderItem)) + .fontSize(16) + .fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) + .textAlign(TextAlign.Center) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .flexShrink(1) + } + .width('100%') + .height(55) + + Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1) + } + .padding({ left: 16 }) + } + .width('100%') + .height(56) + .visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None) + } +} diff --git a/common/component/src/main/ets/default/NoteListComp.ets b/common/component/src/main/ets/default/NoteListComp.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c7c47d37a8c21f6462633a2fb70c2d9769f4d70 --- /dev/null +++ b/common/component/src/main/ets/default/NoteListComp.ets @@ -0,0 +1,730 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/DateUtil.ets' +import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete, Top, NoteType +} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import {NoteDataMoveDialog, DeleteDialog} from './CusDialogComp.ets' +import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' +import prompt from '@system.prompt' +import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' +import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' +import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import SearchModel from '../../../../../../common/utils/src/main/ets/default/model/searchModel/SearchModel.ets' +import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' + +const TAG = "NoteListComp" + +// Note list component +@Component +export struct NoteListComp { + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('Search') search: boolean + controllerShow: WebController + + build() { + Stack({ alignContent: Alignment.Bottom }) { + + Flex({ direction: FlexDirection.Column }) { + NoteOverViewComp({controllerShow: this.controllerShow}) + NoteItemListComp({controllerShow: this.controllerShow}) + } + .padding({ top: this.search ? 15 : 0 }) + .width('100%') + .height('100%') + + OperateNoteCompForPortrait() + } + .height('100%') + .width('100%') + } +} + +@Component +struct NoteOverViewComp { + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('SectionStatus') sectionStatus: number + @Consume("Longpress") longpress: boolean + @Consume('ExpandStatus') expandStatus: boolean + @Consume('Search') search: boolean + controllerShow: WebController + + build() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { + Image($r("app.media.suojin_back")) + .height(24) + .width(24) + .margin({ right: this.sectionStatus != 3 ? 24 : 0 }) // 两分栏时缩进图片与右边有个24的间距 + .visibility(this.sectionStatus != 3 ? Visibility.Visible : Visibility.None) + .onClick(() => { + if (this.sectionStatus == 1) { + this.expandStatus = !this.expandStatus + } else { + this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) + // 迁移 + console.log("NoteOverViewComp, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + console.log("NoteOverViewComp, set continue section success") + } + }) + Flex({ + direction: FlexDirection.Column, + wrap: FlexWrap.Wrap, + justifyContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text(FolderUtil.getFolderText(this.selectedFolderData)) + .fontSize(30).fontColor('#182431') + Row() { + Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString()) + .fontSize(14).fontColor('#182431') + Text($r("app.string.noteslist")) + .fontSize(14).fontColor('#182431') + } + .visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible) + }.visibility(this.longpress ? Visibility.None : Visibility.Visible) + + Row() { + Image($r("app.media.cross")) + .height(24) + .width(24) + .onClick(() => { + this.longpress = false + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + }) + Text(this.CheckedNoteArray.length == 0 ? $r("app.string.none_selected") : $r("app.string.selected", this.CheckedNoteArray.length)) + .fontSize(20).fontColor('#182431').margin({ left: 16 }) + }.alignItems(VerticalAlign.Center).visibility(this.longpress ? Visibility.Visible : Visibility.None) + }.padding({ top: 8, bottom: 8 }).height('100%') + + AddNoteComp({controllerShow: this.controllerShow}) + OperateNoteComp({controllerShow: this.controllerShow}) + Text(this.refreshFlag.toString()).visibility(Visibility.None) + } + .width('100%').height(82) + .padding({ left: this.sectionStatus == 2 ? 24 : 36, right: 24 }) // 两分栏时缩进图标与左侧不需要间距 + .visibility(this.search ? Visibility.None : Visibility.Visible) + } +} + +@Component +export struct NoteItemComp { + public noteItem: NoteData + public spans: any[] + controllerShow: WebController + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @Consume('Longpress') longpress: boolean + @Consume('ChooseNote') chooseNote: boolean + @Consume('RefreshFlag') refreshFlag: number + @Consume('Search') search: boolean + @Consume('selectedAll') selectedAll: boolean + + build() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { + Text(this.refreshFlag.toString()).visibility(Visibility.None) // 用于强制刷新使用 + Column({ space: 2 }) { + Row({ space: 8 }) { + Image($r("app.media.verticalBar")) + .height(16).width(4) + .fillColor(NoteUtil.getVerticalBarBgColor(AppStorage.Get('AllFolderArray'), this.noteItem.folder_uuid)) + Text() { + ForEach(this.spans.map((item1, index1) => { + return { index: index1, data: item1 }; + }), item => { + + if (item.data.type == 0) { + Span(item.data.text).fontColor('#182431').fontSize(16) + } else if (item.data.type == 1) { + Span(item.data.text).fontColor(Color.Blue).fontSize(16) + } + }, + item => item.index) + } + } + + Row({ space: 4 }) { + Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time))) + .fontSize(14) + .fontColor('#182431') + Image($r("app.media.favorite")).height(16).width(16) + .visibility(this.noteItem.is_favorite == Favorite.Yes ? Visibility.Visible : Visibility.None) + Image($r("app.media.topped")).height(16).width(16) + .visibility(this.noteItem.is_top == Top.Yes ? Visibility.Visible : Visibility.None) + } + .padding({ left: 12 }) + }.alignItems(HorizontalAlign.Start) + }.width(240) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Image(this.noteItem.content_img) + .height(48) + .width(48) + .borderRadius(12) + .border({ width: 0.5, color: '#19182431' }) + Stack({ alignContent: Alignment.Center }) { + Image($r("app.media.unChecked")).height(24).width(24) + Image($r("app.media.checked")).width(24).height(24) + .visibility(NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem) ? Visibility.Visible : Visibility.None) + }.width(24).height(24).visibility(this.longpress ? Visibility.Visible : Visibility.None) + }.height(48).width(this.longpress ? 80 : 48) + } + .width('100%') + .height(72) + .padding({ left: 16, right: 12, top: 4, bottom: 4 }) + .borderRadius(24) + .linearGradient({ + direction: GradientDirection.Right, + colors: this.selectedNoteData.uuid == this.noteItem.uuid ? [[0xffcdae, 0.0], [0xFfece2, 1.0]] : [[0xffffff, 0.0], [0xffffff, 1.0]] + }) + .onClick(() => { + if (this.search) { + this.search = false + return + } + if (this.longpress) { + if (NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)) { + NoteUtil.unsetNoteChecked(this.CheckedNoteArray, this.noteItem) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + } else { + NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + } + } else { + this.selectedNoteData = this.noteItem + this.chooseNote = true + // 迁移 + console.log("NoteItemComp, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("NoteItemComp, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("NoteItemComp, set continue note success") + } + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + this.controllerShow.runJavaScript({script:"RE.updateRichTextState()"}) + this.selectedAll = this.CheckedNoteArray.length == + NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + .gesture( + GestureGroup(GestureMode.Exclusive, + // 长按:对笔记列表进行操作 + LongPressGesture() + .onAction(() => { + if (this.longpress == false) { + this.longpress = true + NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem) + } + }) + ) + ) + + } +} + +@Component +export struct NoteItemListComp { + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('Longpress') longpress: boolean + @Consume('Search') search: boolean + @Consume @Watch('doSearch') inputKeyword: string + @Consume('SearchResultList') searchResultList: NoteData[] + @Consume('SelectedNoteData') selectedNoteData: NoteData; + controllerShow: WebController + + doSearch() { + SearchModel.search(NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid), this.inputKeyword) + .then((result: NoteData[]) => { + LogUtil.info(TAG, "result size " + result.length.toString()) + this.searchResultList = result + if (this.searchResultList.length != 0) { + this.selectedNoteData = this.searchResultList[0] + } else { + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + } + // 迁移 + console.log("doSearch, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("doSearch, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("doSearch, set continue note success") + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + } + + build() { + Column() { + Text(this.refreshFlag.toString()).visibility(Visibility.None) + Flex() { + SearchComp() + }.margin({ left: 24, right: 24, bottom: 12 }) + .visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible) + + Flex({ justifyContent: FlexAlign.Center }) { + Text($r("app.string.permanently_delete_tips")).fontSize(12).fontColor('#18181A') + } + .margin({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 }) + .width('100%') + .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None) + + Column() { + List({ initialIndex: 0 }) { + ListItem() { + Column({ space: 8 }) { + Image($r('app.media.emptyPage')).width(120).height(120) + Text($r("app.string.Empty_page")).fontSize(12).fontColor('#A3A7AD') + } + } + .width('100%').height('100%').padding({ bottom: 120 }) + .visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.Visible : Visibility.None) + + ForEach(this.inputKeyword.length == 0 ? + NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) : this.searchResultList, (noteItem) => { + ListItem() { + NoteItemComp({ + noteItem: noteItem, + spans: SearchModel.splitToHighlightText(noteItem.title, this.inputKeyword), + controllerShow: this.controllerShow + }) + }.margin({ left: 24, right: 24, bottom: 12 }) + }, noteItem => noteItem.uuid.toString()) + }.listDirection(Axis.Vertical) + .edgeEffect(EdgeEffect.Spring) + } + .backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notelist_bgcolor_f1f3f5")) + .opacity(this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_10 : StyleConstants.OPACITY_100) + .height('100%') + } + .height('80%') + .padding({bottom: 1 }) + .onClick(() => { + this.search = false + }) + } +} + +@Component +export struct OperateNoteComp { + @Consume('Longpress') longpress: boolean + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('PortraitModel') portraitModel: boolean + @Consume('selectedAll') selectedAll: boolean + controllerShow: WebController + noteDataMoveDialogCtl: CustomDialogController = new CustomDialogController({ + builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + + onMoveConfirm(folderUuid: string) { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.folder_uuid = folderUuid + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + } + + noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + + onDeleteConfirm() { + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + this.CheckedNoteArray.forEach((noteItem: NoteData) => { + noteItem.is_deleted = Delete.Yes + noteItem.deleted_time = new Date().getTime() + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + } else { + this.CheckedNoteArray.forEach((noteItem: NoteData) => { + NoteUtil.removeNoteData(this.AllNoteArray, noteItem.uuid) + // delete note from db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.delete(predicates_note, null) + }) + } + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.longpress = false + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + // 迁移 + console.log("OperateNoteComp, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("OperateNoteComp, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("OperateNoteComp, set continue note success") + } + + build() { + Row() { + Image($r('app.media.set_top')) + .width(24) + .height(24) + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 24 }) + .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + .onClick(() => { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.is_top = (noteItem.is_top == Top.Yes) ? Top.No : Top.Yes + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + }) + Image($r('app.media.move')) + .width(24) + .height(24) + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 24 }) + .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + .onClick(() => { + this.noteDataMoveDialogCtl.open() + }) + Image($r('app.media.delete')) + .width(24) + .height(24) + .margin({ right: 24 }) + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .onClick(() => { + this.noteDataDeleteDialogCtl.open() + }) + Image($r('app.media.recover')) + .width(24) + .height(24) + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 24 : 0 }) + .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None) + .onClick(() => { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.is_deleted = Delete.No + noteItem.deleted_time = 0 + prompt.showToast({ message: "已恢复", duration: 2000 }) + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + }) + Image(this.selectedAll ? $r('app.media.check_all1') : $r('app.media.check_all')) + .width(24) + .height(24) + .onClick(() => { + if (this.CheckedNoteArray.length < + NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + .length) { + NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)) + } else { + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + } + this.selectedAll = !this.selectedAll + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + } + .width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : 168) + .visibility(this.longpress && this.portraitModel == false ? Visibility.Visible : Visibility.None) + } +} + +@Component +export struct AddNoteComp { + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('Longpress') longpress: boolean + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('SectionStatus') sectionStatus: number + @Consume('LastSectionStatus') lastSectionStatus: number + @Consume('EditModel') editModel:boolean + controllerShow: WebController + + build() { + Image($r('app.media.addNote')) + .width(24).height(24).margin({ right: 12 }) + .onClick(() => { + let noteData = new NoteData(0,"标题",new Date().getTime() + "",SysDefFolderUuid.UnClassified,"","",NoteType.SysDef,Top.No,Favorite.No,Delete.No,new Date().getTime(),new Date().getTime(),0) + + this.AllNoteArray.push(noteData) + RdbStoreUtil.insert(TableName.NoteTable, noteData.toNoteObject(), null) + LogUtil.info(TAG, 'insert new note is:' + noteData.uuid) + + this.selectedNoteData = noteData + if (this.sectionStatus != 1) { + this.lastSectionStatus = this.sectionStatus + this.sectionStatus = 1 + this.controllerShow.runJavaScript({script:"RE.setInputEnabled(true)"}) + } else { + this.sectionStatus = this.lastSectionStatus + } + this.controllerShow.runJavaScript({script:"RE.setHtml('" + this.selectedNoteData.content_text + "')"}) + this.editModel = true + }) + .visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) + } +} + +@Component +export struct SearchComp { + @Consume('Search') search: boolean + @Consume('InputKeyword') inputKeyword: string + + build() { + Row() { + Image($r('app.media.back')) + .width(24) + .height(24) + .margin({ right: this.search ? 16 : 0 }) + .visibility(this.search ? Visibility.Visible : Visibility.None) + .onClick(() => { + this.search = false + }) + + Flex({ justifyContent: FlexAlign.Start }) { + Image($r('app.media.search')).width(18).height(18) + TextInput({ text: this.inputKeyword, placeholder: $r('app.string.searchNote') }) + .backgroundColor($r("app.color.color_ffffff")) + .onChange((value: string) => { + LogUtil.info(TAG, "Search value: " + value) + this.inputKeyword = value + }) + .onClick(() => { + this.search = true + }) + } + .width(this.search ? 344 : 384) + .height(52) + .padding({ left: 12, right: 12, top: 6, bottom: 6 }) + .borderRadius(20) + .backgroundColor($r("app.color.color_ffffff")) + } + } +} + +@Component +export struct OperateNoteCompForPortrait { + @Consume('Longpress') longpress: boolean + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData + @Consume('RefreshFlag') refreshFlag: number + @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('PortraitModel') portraitModel: boolean + noteDataMoveDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) + + onMoveConfirm(folderUuid: string) { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.folder_uuid = folderUuid + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + } + + noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ + builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }), + alignment: DialogAlignment.Bottom, + autoCancel: false, + customStyle: true, + }) + + onDeleteConfirm() { + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + this.CheckedNoteArray.forEach((noteItem: NoteData) => { + noteItem.is_deleted = Delete.Yes + noteItem.deleted_time = new Date().getTime() + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + } else { + this.CheckedNoteArray.forEach((noteItem: NoteData) => { + NoteUtil.removeNoteData(this.AllNoteArray, noteItem.uuid) + // delete note from db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.delete(predicates_note, null) + }) + } + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + this.longpress = false + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + // 迁移 + console.log("OperateNoteCompForPortrait, set continue note") + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + console.log("OperateNoteCompForPortrait, continueNote : " + continueNote) + AppStorage.SetOrCreate('ContinueNote', continueNote) + console.log("OperateNoteCompForPortrait, set continue note success") + } + + build() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + Column() { + Image($r("app.media.set_top")) + .width(24) + .height(24) + .onClick(() => { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.is_top = (noteItem.is_top == Top.Yes) ? Top.No : Top.Yes + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + }) + Text($r("app.string.set_top")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .alignItems(HorizontalAlign.Center) + } + + Column() { + Image($r('app.media.delete')) + .width(24) + .height(24) + .onClick(() => { + this.noteDataDeleteDialogCtlBottom.open() + }) + Text($r("app.string.delete")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .alignItems(HorizontalAlign.Center) + + if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { + Column() { + Image($r('app.media.move')) + .width(24) + .height(24) + .onClick(() => { + this.noteDataMoveDialogCtlBottom.open() + }) + Text($r("app.string.move")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .alignItems(HorizontalAlign.Center) + } + + + if (this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes) { + Column() { + Image($r('app.media.recover')) + .width(24) + .height(24) + .onClick(() => { + this.CheckedNoteArray.forEach((noteItem) => { + noteItem.is_deleted = Delete.No + noteItem.deleted_time = 0 + prompt.showToast({ message: "已恢复", duration: 2000 }) + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid) + RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) + }) + this.longpress = false + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + Text($r("app.string.recover")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) + .enabled(this.CheckedNoteArray.length == 0 ? false : true) + .alignItems(HorizontalAlign.Center) + } + + Column() { + Image($r('app.media.check_all')) + .width(24) + .height(24) + .onClick(() => { + if (this.CheckedNoteArray.length < + NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) + .length) { + NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)) + } else { + NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) + } + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + }) + Text($r("app.string.check_all")) + .fontSize(10).fontColor('#182431') + .padding({ top: 5 }) + } + .alignItems(HorizontalAlign.Center) + } + .width(360) + .height(56) + .visibility(this.longpress && this.portraitModel == true ? Visibility.Visible : Visibility.None) + } +} diff --git a/common/component/src/main/resources/base/element/color.json b/common/component/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..6e15ec2ea3f55bb0cd8814b91854e8a8d02f7ddf --- /dev/null +++ b/common/component/src/main/resources/base/element/color.json @@ -0,0 +1,80 @@ +{ + "color": [ + { + "name": "color_ffffff", + "value": "#ffffff" + }, + { + "name": "delete_color_fa2a2d", + "value": "#fa2a2d" + }, + { + "name": "cancel_color_4fb4e3", + "value": "#4fb4e3" + }, + { + "name": "divider_color_e4e4e4", + "value": "#cce4e4e4" + }, + { + "name": "divider_color_182431", + "value": "#182431" + }, + { + "name": "button_color_419fff", + "value": "#419fff" + }, + { + "name": "button_color_fb4447", + "value": "#fb4447" + }, + { + "name": "text_color_3f97e9", + "value": "#3f97e9" + }, + { + "name": "text_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_182431", + "value": "#182431" + }, + { + "name": "folder_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_ffffff", + "value": "#ffffff" + }, + { + "name": "folder_color_19ffffff", + "value": "#19ffffff" + }, + { + "name": "folder_color_19182431", + "value": "#19182431" + }, + { + "name": "notecontent_color_ffffff", + "value": "#ffffff" + }, + { + "name": "notecontent_color_000000", + "value": "#000000" + }, + { + "name": "folderlist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_000000", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/common/component/src/main/resources/base/element/float.json b/common/component/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..fe803f0649fe2816669468a39f02622d8215da85 --- /dev/null +++ b/common/component/src/main/resources/base/element/float.json @@ -0,0 +1,136 @@ +{ + "float": [ + { + "name": "wh_value_1", + "value": "1" + }, + { + "name": "wh_value_4", + "value": "4" + }, + { + "name": "wh_value_5", + "value": "5" + }, + { + "name": "wh_value_8", + "value": "8" + }, + { + "name": "wh_value_10", + "value": "10" + }, + { + "name": "wh_value_14", + "value": "14" + }, + { + "name": "wh_value_16", + "value": "16" + }, + { + "name": "wh_value_20", + "value": "20" + }, + { + "name": "wh_value_24", + "value": "24" + }, + { + "name": "wh_value_30", + "value": "30" + }, + { + "name": "wh_value_40", + "value": "40" + }, + { + "name": "wh_value_50", + "value": "50" + }, + { + "name": "wh_value_60", + "value": "60" + }, + { + "name": "wh_value_65", + "value": "65" + }, + { + "name": "wh_value_70", + "value": "70" + }, + { + "name": "wh_value_80", + "value": "80" + }, + { + "name": "wh_value_100", + "value": "100" + }, + { + "name": "wh_value_120", + "value": "120" + }, + { + "name": "wh_value_130", + "value": "1300" + }, + { + "name": "wh_value_160", + "value": "160" + }, + { + "name": "wh_value_230", + "value": "230" + }, + { + "name": "wh_value_280", + "value": "280" + }, + { + "name": "wh_value_390", + "value": "390" + }, + { + "name": "wh_value_400", + "value": "400" + }, + { + "name": "font_35", + "value": "35" + }, + { + "name": "font_15", + "value": "15" + }, + { + "name": "font_20", + "value": "20" + }, + { + "name": "font_25", + "value": "25" + }, + { + "name": "font_28", + "value": "28" + }, + { + "name": "font_50", + "value": "50" + }, + { + "name": "control_common_font_size", + "value": "20" + }, + { + "name": "slider_text_padding_left", + "value": "5" + }, + { + "name": "volume_border_radius", + "value": "15" + } + ] +} \ No newline at end of file diff --git a/common/component/src/main/resources/base/element/string.json b/common/component/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3b06a900c144024459b84a0b4f32a61d3b30d264 --- /dev/null +++ b/common/component/src/main/resources/base/element/string.json @@ -0,0 +1,140 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "备忘录" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "note", + "value": "笔记" + }, + { + "name": "allNotes", + "value": "全部笔记" + }, + { + "name": "unClassified", + "value": "未分类" + }, + { + "name": "recentDeletes", + "value": "最近删除" + }, + { + "name": "myFavorites", + "value": "我的收藏" + }, + { + "name": "create", + "value": "新建" + }, + { + "name": "createFolder", + "value": "新建文件夹" + }, + { + "name": "editFolder", + "value": "编辑文件夹" + }, + { + "name": "deleteFolder", + "value": "删除文件夹" + }, + { + "name": "createNote", + "value": "新建笔记" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "save", + "value": "保存" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "name", + "value": "名称" + }, + { + "name": "delete_tips", + "value": "是否删除此文件夹及其中的内容?" + }, + { + "name": "deleteNote", + "value": "是否删除此笔记?" + }, + { + "name": "deleteNoteComplete", + "value": "此笔记将被永久删除,无法恢复。是否删除?" + }, + { + "name": "deleteAllNote", + "value": "是否删除全部笔记?" + }, + { + "name": "deletePartNote", + "value": "是否删除%d条笔记?" + }, + { + "name": "selected", + "value": "已选择%d项" + }, + { + "name": "none_selected", + "value": "未选择" + }, + { + "name": "noteslist", + "value": "条笔记" + }, + { + "name": "Empty_page", + "value": "没有笔记" + }, + { + "name": "searchNote", + "value": "搜索笔记" + }, + { + "name": "chooseFolder", + "value": "请选择文件夹" + }, + { + "name": "category_already_exist", + "value": "文件夹名称已存在" + }, + { + "name": "input_placeholder", + "value": "名称" + }, + { + "name": "permanently_delete_tips", + "value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除" + }, + { + "name": "set_top", + "value": "置顶" + }, + { + "name": "move", + "value": "移到" + }, + { + "name": "recover", + "value": "恢复" + }, + { + "name": "check_all", + "value": "多选" + } + ] +} \ No newline at end of file diff --git a/common/utils/build.gradle b/common/utils/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..17f0e439e73b199759d92f803b01e03644ce91d3 --- /dev/null +++ b/common/utils/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.library' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + defaultConfig { + compatibleSdkVersion 8 + } + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { +} diff --git a/common/utils/proguard-rules.pro b/common/utils/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/common/utils/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/common/utils/src/main/config.json b/common/utils/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..69ee57bd96d2471359216214333c2c571d35c8a5 --- /dev/null +++ b/common/utils/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.note", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.note.common", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "utils", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/DateUtil.ets b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbf65923ec170843bc831a151cf51b652fa15506 --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets @@ -0,0 +1,122 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LogUtil from './LogUtil.ets' +import GlobalResourceManager from './GlobalResourceManager.ets' +const TAG = "DateUtil" + +/** + * 日期和时间均显示为2位数 + * @param time + */ +function getUnifiedTime(time: number): any { + return time > 9 ? time : "0" + time +} + +/** + * 日期时间工具类, 中文暂时不写到string.json, $r("")取出来的是Resource, 转化为string困难 + */ +export class DateUtil { + /** + * 获取笔记标题的格式化时间 + * @param date note modified time + */ + formateDateForNoteTitle(date: Date): string{ + let nowDate = new Date() + let diffMin = Math.floor((nowDate.getTime() - date.getTime()) / 1000 / 60) + if (diffMin < 0) { + LogUtil.info("DateUtils, formateDateForNoteTitle : date is error") + return this.formateDateForNoteContent(date) + } + + let noteTitletTime = "" + let year = date.getFullYear() + let month = date.getMonth() + let day = date.getDate() + let hours = date.getHours() + let mins = date.getMinutes() + + let nowYear = nowDate.getFullYear() + let nowMonth = nowDate.getMonth() + let nowDay = nowDate.getDate() + + if (diffMin < 1) { + // 1分钟内, 显示“刚刚” + noteTitletTime = "刚刚" + } else if (diffMin < 60) { + // 1小时内, 显示“X分钟前” + noteTitletTime = diffMin + "分钟前" + } else if (nowYear === year && nowMonth === month && nowDay === day) { + // 今天, 显示“hh:mm” + noteTitletTime = getUnifiedTime(hours) + ":" + getUnifiedTime(mins) + } else if (nowYear === year && nowMonth === month && nowDay === (day + 1)) { + // 昨天, 场景1: 2022年1月1日 - 2022年1月2日, 显示“昨天” + noteTitletTime = "昨天" + } else if (nowYear === year && nowDay === 1) { + // 昨天, 场景2: 2022年1月31日 - 2022年2月1日, 显示“昨天” + let now = new Date() + now.setDate(0) // 设置为上个月的最后一天 + noteTitletTime = now.getDate() === day ? "昨天" : "" + } else if (nowYear === year + 1 && nowDay === 1) { + // 昨天, 场景3: 2022年12月31日 - 2023年1月1日, 显示“昨天” + let now = new Date() + now.setMonth(-1) // 设置为去年的最后一个月 + noteTitletTime = now.getMonth() === month ? "昨天" : "" + } else if (nowYear === year) { + // 今年, 显示“X月X日” + noteTitletTime = getUnifiedTime(month + 1) + "月" + getUnifiedTime(day) + "日" + } else { + // 不是今年, 显示“X年X月X日” + noteTitletTime = year + "年" + getUnifiedTime(month + 1) + "月" + getUnifiedTime(day) + "日" + } + return noteTitletTime + } + + /** + * 获取笔记内容的格式化时间 + * @param date note modified time + */ + formateDateForNoteContent(date: Date): string{ + // formatted time + let noteContentTime = "" + // note modified time + let year = date.getFullYear() + let month = date.getMonth() + let day = date.getDate() + let hours = date.getHours() + let mins = date.getMinutes() + // now date + let nowDate = new Date() + let nowYear = nowDate.getFullYear() + let nowMonth = nowDate.getMonth() + let nowDay = nowDate.getDate() + if (nowYear === year && nowMonth === month && nowDay === day) { + // 今天, 显示“hh:mm” + noteContentTime = "今天" + " " + getUnifiedTime(hours) + ":" + getUnifiedTime(mins) + } else if (nowYear === year) { + // 今年, 显示“X月X日 hh:mm” + noteContentTime = getUnifiedTime(month + 1) + "月" + getUnifiedTime(day) + "日" + + " " + getUnifiedTime(hours) + ":" + getUnifiedTime(mins) + } else { + // 不是今年, 显示“X年X月X日 hh:mm” + noteContentTime = year + "年" + getUnifiedTime(month + 1) + "月" + getUnifiedTime(day) + "日" + + " " + getUnifiedTime(hours) + ":" + getUnifiedTime(mins) + } + return noteContentTime + } +} + +let dateUtil = new DateUtil() +export default dateUtil as DateUtil \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..966f76d7a4007ac83f804de2d4b106ada286ca2e --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LogUtil from '../../common/baseUtil/LogUtil.ets' +import SysDefData from '../../model/databaseModel/SysDefData.ets' +import FolderData from '../../model/databaseModel/FolderData.ets' +import NoteData from '../../model/databaseModel/NoteData.ets' + +const TAG = "FakerRdbStoreUtil" +let folderDataArray = [] +let noteDataArray = [] + +function FakerInitFolder(folderdata: any) { + return new FolderData(0, folderdata.name, folderdata.uuid, folderdata.color, folderdata.folder_type, folderdata.is_deleted, + folderdata.created_time, folderdata.modified_time) +} + +function FakerInitFolderArray(folderdataList: any[]) { + folderdataList.forEach((folderData) => { + folderDataArray.push(FakerInitFolder(folderData)) + }) +} + +function FakerInitNote(noteData: any) :NoteData{ + return new NoteData(0, noteData.title, noteData.uuid, noteData.folder_uuid, noteData.content_text, noteData.content_img, + noteData.note_type, 0, 0, 0, noteData.created_time, noteData.modified_time, noteData.deleted_time) +} + +function FakerInitNoteArray(noteDataList: any[]) { + noteDataList.forEach((noteData) => { + noteDataArray.push(FakerInitNote(noteData)) + }) +} + +export default { + FakerInitAppStorage() { + FakerInitFolderArray([SysDefData.sys_def_allNotes, SysDefData.sys_def_unClassified, SysDefData.sys_def_life,SysDefData.sys_def_recentDeletes, SysDefData.sys_def_myFavorites, + SysDefData.sys_def_personal, SysDefData.sys_def_work]) + FakerInitNoteArray([SysDefData.sys_def_note1,SysDefData.sys_def_note2, SysDefData.sys_def_note3, SysDefData.sys_def_note4]) + AppStorage.SetOrCreate('AllNoteArray', noteDataArray) + AppStorage.SetOrCreate('AllFolderArray', folderDataArray) + for (let folderData of folderDataArray) { + LogUtil.info(TAG, "folderData : " + JSON.stringify(folderData)) + } + for (let noteData of noteDataArray) { + LogUtil.info(TAG, "noteDataArray : " + JSON.stringify(noteData)) + } + AppStorage.SetOrCreate('DBQueryFinished', 1) + } + +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets b/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..966fd3c20e805411b94d4760b8e23397f3f97d44 --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets @@ -0,0 +1,193 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {folderIconMap, folderTextMap} from '../model/NoteBaseData.ets' +import FolderData from '../model/databaseModel/FolderData.ets' +import NoteData from '../model/databaseModel/NoteData.ets' +import {SysDefFolderUuid, FolderType, Favorite, Delete} from '../model/databaseModel/EnumData.ets' +import GlobalResourceManager from './GlobalResourceManager.ets' +import StyleConstants from '../constants/StyleConstants.ets' +import LogUtil from './LogUtil.ets' + +const TAG = "FolderUtil" +export class FolderUtil { + /** + * Get Folder Data + * + * @param folderDataArray - Folder data list + * @param folderUuid - fold uuid + * @return FolderData + */ + getFolderData(folderDataArray: FolderData[], folderUuid: string): FolderData { + LogUtil.info(TAG, "get folder uuid " + folderUuid) + let folderData = folderDataArray.find((folder) => { + return folder.uuid == folderUuid + }) + if (folderData == undefined) { + LogUtil.info(TAG, "no folder get " + folderUuid) + } + return folderData + } + + /** + * Get Folder Icon + * + * @param folderUuid - folder Uuid + * @return Resource - Folder Icon Resource + */ + getFolderIcon(folderUuid: string): Resource { + LogUtil.info(TAG, "folderUuid " + folderUuid) + if (folderIconMap[folderUuid] != undefined) { + return folderIconMap[folderUuid] + } + return $r("app.media.folder") + } + + /** + * Get folder Icon color + * + * @param folderDataArray - Folder data list + * @param selectFolderUuid - Selected fold uuid + * @param isSelected - is selected or not + * @return Resource | string - color value + */ + getFolderIconColor(folderDataArray: FolderData[], selectFolderUuid: string, isSelected: boolean): Resource | string { + let folderData: FolderData = this.getFolderData(folderDataArray, selectFolderUuid) + if (folderData == undefined) { + LogUtil.info(TAG, "FolderIconColor is 182431") + return $r("app.color.folder_color_182431") + } + LogUtil.info(TAG, "folderData uuid " + folderData.uuid + " isSelected " + isSelected) + if (folderData.folder_type == FolderType.SysDef || folderData.folder_type == FolderType.FeatureDef) { + return isSelected ? $r("app.color.folder_color_f86d05") : $r("app.color.folder_color_182431") + } + return folderData.color + } + + /** + * Get folder Text color + * + * @param isSelected - is selected or not + * @return Resource | string - color value + */ + getFolderTextColor(isSelected: boolean): Resource | string { + LogUtil.info(TAG, "isSelected " + isSelected) + return isSelected ? $r("app.color.folder_color_f86d05") : $r("app.color.folder_color_182431") + } + + /** + * Is folder bottom fixed + * + * @param folderData - Folder + * @return boolean - fottom fixed folder: deleted or favorite return true. else return false + */ + isBottomFixedFolder(folderData: FolderData) : boolean { + LogUtil.info(TAG, "folderDataUuid " + folderData.uuid) + return (folderData.folder_type == FolderType.FeatureDef) + } + + /** + * Is the folder can be moved into notes + * + * @param folderDataUuid - Folder uuid + * @return boolean - can be moved into notes return true. else return false + */ + isFolderMoveIn(folderData: FolderData) : boolean { + LogUtil.info(TAG, "folderDataUuid " + folderData.uuid) + return (folderData.uuid == SysDefFolderUuid.UnClassified || folderData.folder_type == FolderType.CusDef) + } + + /** + * Get folder text + * + * @param folderData + * @return string | Resource - folder text + */ + getFolderText(folderData: FolderData): string | Resource { + LogUtil.info(TAG, "folderData.uuid " + folderData.uuid + " folderData.folder_type " + folderData.folder_type) + return folderData.folder_type == FolderType.CusDef ? folderData.name : folderTextMap[folderData.uuid] + } + + /** + * Get Note Count + * + * @param noteDataArray + * @param folderUuid + * @return number - Note Count + */ + getNoteCount(noteDataArray: NoteData[], folderUuid: string): number { + let count = 0; + const folderTextMap = { + "sys_def_allNotes_uuid": (noteData) => {noteData.is_deleted == Delete.No ? ++count : count}, + "sys_def_recentDeletes_uuid": (noteData) => {noteData.is_deleted == Delete.Yes ? ++count : count}, + "sys_def_myFavorites_uuid": (noteData) => {noteData.is_favorite == Favorite.Yes && noteData.is_deleted == Delete.No ? ++count : count}, + "sys_def_other_uuid": (noteData) => {noteData.folder_uuid == folderUuid && noteData.is_deleted == Delete.No ? ++count : count}, + } + if (folderUuid == SysDefFolderUuid.AllNotes || folderUuid == SysDefFolderUuid.RecentDeletes || folderUuid == SysDefFolderUuid.MyFavorites) { + noteDataArray.forEach(folderTextMap[folderUuid]) + } else { + noteDataArray.forEach(folderTextMap["sys_def_other_uuid"]) + } + LogUtil.info(TAG, "folderUuid " + folderUuid + " count " + count.toString()) + return count; + } + + /** + * Get common FolderData + * + * @param folderDataArray - Folder data list + * @param selectedNoteArray - Selected note data list + * @return FolderData - return folder when note data list belong to the same folder, else return null + */ + getCommonFolder(folderDataArray: FolderData[], selectedNoteArray: NoteData[]): FolderData { + if (selectedNoteArray.length == 0) { + return null + } + let folderData: FolderData = this.getFolderData(folderDataArray, selectedNoteArray[0].folder_uuid) + let currentFolderData = null + selectedNoteArray.forEach((noteItem) => { + if (folderData != this.getFolderData(folderDataArray, noteItem.folder_uuid)) { + currentFolderData = this.getFolderData(folderDataArray, noteItem.folder_uuid).name + } + }) + return (currentFolderData == null) ? folderData : null + } + + /** + * folder name duplicate detection + * + * @param inputStr - Folder name input + * @param folderDataArray - folder already exist + * @return Promise - if input name exist, return true, else return false + */ + async duplicateDetection(inputStr: string, folderDataArray: FolderData[]): Promise { + for (let index = 0; index < folderDataArray.length; index++) { + if (folderDataArray[index].folder_type == FolderType.CusDef && folderDataArray[index].name == inputStr) { + return true + } else { + let temp = GlobalResourceManager.getStringByResource(this.getFolderText(folderDataArray[index])) + temp.then(result => { + if (result == inputStr) { + return true + } + }) + } + } + return false +} + +} + +let folderUtil = new FolderUtil() +export default folderUtil as FolderUtil \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..975a546aa7289cb5a5fb246876ee0afd541062b6 --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Rsm from '@ohos.resourceManager'; +const TAG = "Note_GlobalResourceManager" + +export class GlobalResourceManager { + + public async getStringByResource(res: any): Promise{ + let json = JSON.parse(JSON.stringify(res)); + let id = json.id; + console.info(TAG, "ResourceID = %d", id) + return await this.getStringById(id); + } + + public getStringById(id: number): Promise{ + let promise = new Promise(resolve => { + let resourceMgr = Rsm.getResourceManager("com.example.note"); + resourceMgr.then((result) => { + result.getString(id) + .then((resource) => { + resolve(resource); + console.info('getStringById resolve(resource) : ' + resolve(resource)); + console.info('getStringById resource : ' + resource); + console.info('getStringById resource2 : ' + JSON.stringify(resource)); + }) + .catch((err) => { + console.info('getStringById err : ' + JSON.stringify(err)); + }); + }); + }); + console.info('getStringById promise: ' + JSON.stringify(promise)); + return promise; + } +} + +let mGlobalResourceManager = new GlobalResourceManager(); +export default mGlobalResourceManager as GlobalResourceManager +; diff --git a/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..abfa931483b90adc7cf7aac03a35c5da8fab5894 --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {WidthWeightMessage, unSelectedNoteBgColorMap, selectedNoteBgColorMap, folderTextMap, widthWeightMessageMap} from '../model/NoteBaseData.ets' +import FolderData from '../model/databaseModel/FolderData.ets' +import NoteData from '../model/databaseModel/NoteData.ets' +import {SysDefFolderUuid, FolderType, Favorite, Delete} from '../model/databaseModel/EnumData.ets' +import GlobalResourceManager from './GlobalResourceManager.ets' +import StyleConstants from '../constants/StyleConstants.ets' +import LogUtil from './LogUtil.ets' +import FolderUtil from './FolderUtil.ets' +import NoteUtil from './NoteUtil.ets' + +const TAG = "LayoutUtil" + +export class LayoutUtil { + /** + * Get Width Weight Message + * + * @param sectionStatus - page's section number + * @return WidthWeightMessage + */ + getWidthWeightMessage(sectionStatus: number): WidthWeightMessage { + LogUtil.info(TAG, "sectionStatus " + sectionStatus.toString()) + return widthWeightMessageMap[sectionStatus] + } +} + +let layoutUtil = new LayoutUtil() +export default layoutUtil as LayoutUtil \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/LogUtil.ets b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..a143e3f603dd0663260fe85303eb5d46a99aa90d --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Log Util + */ +export class LogUtil { + getLogFirstStr(tag: string, ...msg) { + let firstStr: string = tag + ", " + msg[0] + " " + try { + throw new Error(); + } catch (e) { + firstStr += e.stack.split('at ')[3].split(' ')[0] + } + return firstStr + } + + debug(tag: string, ...msg) { + if (msg.length == 0) { + console.debug(tag) + return + } + let firstStr = this.getLogFirstStr(tag, ...msg) + msg.shift() + console.debug(firstStr, ...msg) + } + + info(tag: string, ...msg) { + if (msg.length == 0) { + console.debug(tag) + return + } + let firstStr = this.getLogFirstStr(tag, ...msg) + msg.shift() + console.info(firstStr, ...msg) + } + + warn(tag: string, ...msg) { + if (msg.length == 0) { + console.debug(tag) + return + } + let firstStr = this.getLogFirstStr(tag, ...msg) + msg.shift() + console.warn(firstStr, ...msg) + } + + error(tag: string, ...msg) { + if (msg.length == 0) { + console.debug(tag) + return + } + let firstStr = this.getLogFirstStr(tag, ...msg) + msg.shift() + console.error(firstStr, ...msg) + } +} + +let mLogUtil = new LogUtil(); +export default mLogUtil as LogUtil \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..81fd00a9f19f7ea37032d7f4233f1a61a23e3369 --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets @@ -0,0 +1,250 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {WidthWeightMessage, unSelectedNoteBgColorMap, selectedNoteBgColorMap, folderTextMap, widthWeightMessageMap} from '../model/NoteBaseData.ets' +import FolderData from '../model/databaseModel/FolderData.ets' +import NoteData from '../model/databaseModel/NoteData.ets' +import {SysDefFolderUuid, FolderType, Favorite, Delete,TableName, NoteTableColumn,} from '../model/databaseModel/EnumData.ets' +import GlobalResourceManager from './GlobalResourceManager.ets' +import StyleConstants from '../constants/StyleConstants.ets' +import LogUtil from './LogUtil.ets' +import FolderUtil from './FolderUtil.ets' +import RdbStoreUtil from './RdbStoreUtil.ets' + +const TAG = "NoteUtil" + +export class NoteUtil { + /** + * Set Note Checked status + * + * @param checkedNoteArray - Checked status Note list + * @param noteItem - note + */ + setNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) { + LogUtil.info(TAG, "setNoteChecked") + checkedNoteArray.push(noteItem) + } + + /** + * unset Note with Checked status + * + * @param checkedNoteArray - Checked status Note list + * @param noteItem - note + */ + unsetNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) { + let index = checkedNoteArray.findIndex((note) => { + return note == noteItem + }) + LogUtil.info(TAG, "index " + index.toString() + noteItem.uuid) + index == -1 ? null : checkedNoteArray.splice(index, 1) + } + + /** + * Is Note Checked status + * + * @param checkedNoteArray - Checked status Note list + * @param noteItem - note + * @return boolean - Checked: true, unchecked: false + */ + isNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData): boolean { + for(let i = 0; i < checkedNoteArray.length; i++) { + LogUtil.info(TAG, "index " + checkedNoteArray[i].uuid + " noteItem uuid: " + noteItem.uuid) + } + let index = checkedNoteArray.findIndex((note) => { + return note.uuid == noteItem.uuid + }) + LogUtil.info(TAG, "index " + index.toString() + " noteItem uuid: " + noteItem.uuid) + return index != -1 + } + + /** + * Set all notes Checked status + * + * @param checkedNoteArray - Checked status Note list + * @param selectedNoteArray - note array + */ + setAllNotesChecked(checkedNoteArray: NoteData[], noteArray: NoteData[]) { + LogUtil.info(TAG, "setAllNotesChecked") + this.unsetAllNotesChecked(checkedNoteArray) + checkedNoteArray.push(...noteArray) + } + + /** + * unset all Notes with Checked status + * + * @param CheckedNoteArray - Checked status Note list + */ + unsetAllNotesChecked(checkedNoteArray: NoteData[]) { + LogUtil.info(TAG, "unsetAllNotesChecked") + checkedNoteArray.splice(0, checkedNoteArray.length) + } + + /** + * Get Note Count in folder + * + * @param noteDataArray + * @param folderData + * @return number - Note Count + */ + getNoteCount(noteDataArray: NoteData[], folderData: FolderData): number { + let count = 0; + const folderTextMap = { + "sys_def_allNotes_uuid": (noteData) => {noteData.is_deleted == Delete.No ? ++count : count}, + "sys_def_recentDeletes_uuid": (noteData) => {noteData.is_deleted == Delete.Yes ? ++count : count}, + "sys_def_myFavorites_uuid": (noteData) => {noteData.is_favorite == Favorite.Yes && noteData.is_deleted == Delete.No ? ++count : count}, + "sys_def_other_uuid": (noteData) => {noteData.folder_uuid == folderData.uuid && noteData.is_deleted == Delete.No ? ++count : count} + } + if (folderData.uuid == SysDefFolderUuid.AllNotes || folderData.folder_type == FolderType.FeatureDef) { + noteDataArray.forEach(folderTextMap[folderData.uuid]) + } else { + noteDataArray.forEach(folderTextMap["sys_def_other_uuid"]) + } + LogUtil.info(TAG, "folderUuid " + folderData.uuid + " count " + count.toString()) + return count; + } + + /** + * Get note background color + * + * @param folderDataArray - Folder data list + * @param uuid - note's folder_uuid + * @param selectFolderUuid - selected folder's uuid + * @param isSelected - is selected or not + * @return Resource | string - color value + */ + getNoteBgColor(folderDataArray: FolderData[], uuid: string, selectFolderUuid: string, isSelected: boolean): Resource | string { + let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid) + if (folderData == undefined || (selectFolderUuid != SysDefFolderUuid.AllNotes && !isSelected)) { + LogUtil.info(TAG, "NoteBgColor is ffffff") + return $r("app.color.color_ffffff") + } + LogUtil.info(TAG, "isSelected %s, folderData.color: %s", isSelected, folderData.color) + return isSelected ? selectedNoteBgColorMap[folderData.color] : unSelectedNoteBgColorMap[folderData.color] + } + + /** + * Get verticalBar background color + * + * @param folderDataArray - Folder data list + * @param uuid - note's folder_uuid + * @return Resource | string - color value + */ + getVerticalBarBgColor(folderDataArray: FolderData[], uuid: string): Resource | string { + let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid) + if (folderData == undefined) { + LogUtil.info(TAG, "NoteBgColor is ffffff") + return $r("app.color.color_ffffff") + } + LogUtil.info(TAG, "isSelected %s, folderData.color: %s", folderData.color) + if (folderData.color == "#ffffff") { + return "#ff9516" + } + return folderData.color + } + + /** + * Automatically delete notes in the deleted folder more than 30 days + * + * @param allNoteDataArray + */ + autoDeleteNote(allNoteDataArray: NoteData[]) { + for (let index = 0; index < allNoteDataArray.length;) { + if (allNoteDataArray[index].is_deleted == Delete.Yes && new Date().getTime() - allNoteDataArray[index].deleted_time > StyleConstants.DELETE_DEADLINE) { + LogUtil.info(TAG, "Delete Note, uuid " + allNoteDataArray[index].uuid + " delete time " + allNoteDataArray[index].deleted_time) + allNoteDataArray.splice(index, 1); + } + index++ + } + } + + /** + * Get Note Count + * + * @param allNoteDataArray + * @param folderUuid + * @return NoteData[] - return Note in folder + */ + getNoteDataArray(allNoteDataArray: NoteData[], folderUuid: string): NoteData[] { + LogUtil.info(TAG, "folderUuid " + folderUuid) + this.autoDeleteNote(allNoteDataArray) + let noteDataArray: NoteData[] = []; + let func = (noteData) => noteDataArray.push(noteData) + const folderTextMap = { + "sys_def_allNotes_uuid": (noteData) => {noteData.is_deleted == Delete.No ? func(noteData) : null}, + "sys_def_recentDeletes_uuid": (noteData) => {noteData.is_deleted == Delete.Yes ? func(noteData) : null}, + "sys_def_myFavorites_uuid": (noteData) => {noteData.is_favorite == Favorite.Yes && noteData.is_deleted == Delete.No ? func(noteData) : null}, + "sys_def_other_uuid": (noteData) => {noteData.folder_uuid == folderUuid && noteData.is_deleted == Delete.No ? func(noteData) : null}, + } + if (folderUuid == SysDefFolderUuid.AllNotes || folderUuid == SysDefFolderUuid.RecentDeletes || folderUuid == SysDefFolderUuid.MyFavorites) { + allNoteDataArray.forEach(folderTextMap[folderUuid]) + } else { + allNoteDataArray.forEach(folderTextMap["sys_def_other_uuid"]) + } + // Sort priority: 1、Top or not 2、created time + noteDataArray.sort((noteItemLeft: NoteData, noteItemRight: NoteData) => { + if (noteItemRight.is_top != noteItemLeft.is_top) { + return noteItemRight.is_top - noteItemLeft.is_top + } + return noteItemRight.created_time - noteItemLeft.created_time + }) + LogUtil.info(TAG, "noteDataArray size " + noteDataArray.length.toString()) + return noteDataArray + } + + /** + * Get First Note in note array + * + * @param allNoteDataArray + * @param folderUuid + * @return NoteData + */ + getFirstNoteData(allNoteDataArray: NoteData[], folderUuid: string): NoteData { + let noteDataArray: NoteData[] = this.getNoteDataArray(allNoteDataArray, folderUuid); + LogUtil.info(TAG, "get noteDataArray size " + noteDataArray.length.toString()) + return noteDataArray == undefined ? null : noteDataArray[0] + } + + /** + * Remove NoteData + * + * @param allNoteDataArray + * @param noteUuid + */ + removeNoteData(allNoteDataArray: NoteData[], noteUuid: string) { + let index = allNoteDataArray.findIndex((note) => { + return note.uuid == noteUuid + }) + LogUtil.info(TAG, "index " + index.toString() + " uuid " + noteUuid) + index == -1 ? null : allNoteDataArray.splice(index, 1) + } + + deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[],controllerShow: WebController) { + LogUtil.info(TAG, selectedNoteData.content_text) + if (selectedNoteData.title == "标题" && selectedNoteData.content_text == "") { + // delete note from db + noteUtil.removeNoteData(AllNoteArray,selectedNoteData.uuid) + LogUtil.info(TAG, "delete note:" + selectedNoteData.content_text) + LogUtil.info(TAG, "delete note:" + selectedNoteData.uuid) + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, selectedNoteData.uuid) + RdbStoreUtil.delete(predicates_note, null) + LogUtil.info(TAG, "delete note success:" + selectedNoteData.uuid) + selectedNoteData = AllNoteArray[0] + controllerShow.runJavaScript({script:"RE.setHtml('" + selectedNoteData.content_text + "')"}) + } + } +} + +let noteUtil = new NoteUtil() +export default noteUtil as NoteUtil \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..9722fb621729051c444409f6b0dcddae6f34f5fd --- /dev/null +++ b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets @@ -0,0 +1,311 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ohosDataRdb from '@ohos.data.rdb' +import LogUtil from './LogUtil.ets' +import SysDefData from '../model/databaseModel/SysDefData.ets' +import FolderData from '../model/databaseModel/FolderData.ets' +import NoteData from '../model/databaseModel/NoteData.ets' +import {TableSql, TableName, FolderTableColumn, NoteTableColumn} from '../model/databaseModel/EnumData.ets' + +const TAG = "RdbStoreUtil" + +/** + * db instance + */ +var rdbStore = undefined + +export default { + /** + * create db and table + */ + createRdbStore(context) { + ohosDataRdb.getRdbStore(context, SysDefData.dbInfo.db_name, SysDefData.dbInfo.db_verison) + .then(async (store) => { + LogUtil.info(TAG, "createRdbStore, store is " + store) + rdbStore = store + // create table + await rdbStore.executeSql(TableSql.FolderTableSQL, null) + await rdbStore.executeSql(TableSql.NoteTableSQL, null) + await rdbStore.executeSql(TableSql.AttachmentTableSQL, null) + await rdbStore.executeSql(TableSql.FormTableSQL, null) + LogUtil.info(TAG, "create table success") + // insert system defined folder + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_allNotes) + LogUtil.info(TAG, "insert sys_def_allNotes success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_unClassified) + LogUtil.info(TAG, "insert sys_def_unClassified success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_myFavorites) + LogUtil.info(TAG, "insert sys_def_myFavorites success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_recentDeletes) + LogUtil.info(TAG, "insert sys_def_recentDeletes success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_personal) + LogUtil.info(TAG, "insert sys_def_personal success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_life) + LogUtil.info(TAG, "insert sys_def_life success") + await rdbStore.insert(TableName.FolderTable, SysDefData.sys_def_work) + LogUtil.info(TAG, "insert sys_def_work success") + // insert system defined note and attachment + await rdbStore.insert(TableName.NoteTable, SysDefData.sys_def_note1) + LogUtil.info(TAG, "insert sys_def_note1 success") + await rdbStore.insert(TableName.NoteTable, SysDefData.sys_def_note2) + LogUtil.info(TAG, "insert sys_def_note2 success") + await rdbStore.insert(TableName.NoteTable, SysDefData.sys_def_note3) + LogUtil.info(TAG, "insert sys_def_note3 success") + await rdbStore.insert(TableName.NoteTable, SysDefData.sys_def_note4) + LogUtil.info(TAG, "insert sys_def_note4 success") + + // add sys-def folder and note to AppStorage + let folderDataArray = [] + let sysDefFolderArray = [SysDefData.sys_def_allNotes, SysDefData.sys_def_unClassified, + SysDefData.sys_def_myFavorites, SysDefData.sys_def_recentDeletes, + SysDefData.sys_def_personal, SysDefData.sys_def_life, SysDefData.sys_def_work] + sysDefFolderArray.forEach((sysDefFolder) => { + let folderData = new FolderData(sysDefFolder.id, sysDefFolder.name, sysDefFolder.uuid, sysDefFolder.color, + sysDefFolder.folder_type, sysDefFolder.is_deleted, sysDefFolder.created_time, + sysDefFolder.modified_time) + folderDataArray.push(folderData) + }) + let noteDataArray = [] + let sysDefNoteArray = [SysDefData.sys_def_note1, SysDefData.sys_def_note2, + SysDefData.sys_def_note3, SysDefData.sys_def_note4] + sysDefNoteArray.forEach((sysDefNote) => { + let noteData = new NoteData(sysDefNote.id, sysDefNote.title, sysDefNote.uuid, sysDefNote.folder_uuid, sysDefNote.content_text, + sysDefNote.content_img, sysDefNote.note_type, sysDefNote.is_top, sysDefNote.is_favorite, + sysDefNote.is_deleted, sysDefNote.created_time, sysDefNote.modified_time, sysDefNote.deleted_time) + noteDataArray.push(noteData) + }) + LogUtil.info(TAG, "folderDataArray[sysdef] : " + folderDataArray.length) + for (let folderData of folderDataArray) { + LogUtil.info(TAG, "folderData[sysdef] : " + JSON.stringify(folderData)) + } + LogUtil.info(TAG, "noteDataArray[sysdef] : " + noteDataArray.length) + for (let noteData of noteDataArray) { + LogUtil.info(TAG, "noteData[sysdef] : " + JSON.stringify(noteData)) + } + AppStorage.SetOrCreate('AllFolderArray', folderDataArray) + AppStorage.SetOrCreate('AllNoteArray', noteDataArray) + + // 迁移 + let isContinue = AppStorage.Get('IsContinue'); + LogUtil.info(TAG, "createRdbStore, isContinue is " + isContinue) + if (isContinue != undefined && isContinue == 1) { + console.info("RdbStoreUtil createRdbStore, IsContinue true") + let continueFolder: string = AppStorage.Get('ContinueFolder') + console.log("RdbStoreUtil createRdbStore, continueFolder is " + continueFolder) + let continueNote: string = AppStorage.Get('ContinueNote') + console.log("RdbStoreUtil createRdbStore, continueNote is " + continueNote) + let continueSection = AppStorage.Get('ContinueSection') + console.log("RdbStoreUtil createRdbStore, continueSection is " + continueSection) + + let folderObj = JSON.parse(continueFolder) + let folderData = new FolderData(folderObj.uuid, folderObj.name, folderObj.uuid, folderObj.color, + folderObj.folder_type, folderObj.is_deleted, folderObj.created_time, folderObj.modified_time) + + let noteObj = JSON.parse(continueNote) + let noteData = new NoteData(noteObj.uuid, noteObj.title, noteObj.uuid, noteObj.folder_uuid, + noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite, + noteObj.is_deleted, noteObj.created_time, noteObj.modified_time, noteObj.deleted_time) + + AppStorage.SetOrCreate('Folder', folderData) + AppStorage.SetOrCreate('Note', noteData) + AppStorage.SetOrCreate('Section', continueSection) + } else { + console.info("RdbStoreUtil createRdbStore, IsContinue false") + AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) + AppStorage.SetOrCreate('Note', AppStorage.Get('AllNoteArray')[0]) + AppStorage.SetOrCreate('Section', 3) + } + AppStorage.SetOrCreate('DBQueryFinished', 1) + LogUtil.info(TAG, "createRdbStore, set DBQueryFinished 1") + }) + .catch((err) => { + LogUtil.error(TAG, "createRdbStore, error : " + err) + }) + }, + + /** + * query folders and notes from the database, then save them to the AppStorage. + */ + initAppStorage(context) { + let folderDataArray = [] + let noteDataArray = [] + ohosDataRdb.getRdbStore(context, SysDefData.dbInfo.db_name, SysDefData.dbInfo.db_verison) + .then(async (store) => { + LogUtil.info(TAG, "initAppStorage, store is " + store) + rdbStore = store + // query folder + let columns_folder = [] + let predicates_folder = new ohosDataRdb.RdbPredicates(TableName.FolderTable) + let resultSet_folder = await rdbStore.query(predicates_folder, columns_folder) + while (resultSet_folder.goToNextRow()) { + let id = resultSet_folder.getLong(resultSet_folder.getColumnIndex(FolderTableColumn.Id)) + let name = resultSet_folder.getString(resultSet_folder.getColumnIndex(FolderTableColumn.Name)) + let uuid = resultSet_folder.getString(resultSet_folder.getColumnIndex(FolderTableColumn.Uuid)) + let color = resultSet_folder.getString(resultSet_folder.getColumnIndex(FolderTableColumn.Color)) + let folder_type = resultSet_folder.getLong(resultSet_folder.getColumnIndex(FolderTableColumn.FolderType)) + let is_deleted = resultSet_folder.getLong(resultSet_folder.getColumnIndex(FolderTableColumn.IsDeleted)) + let created_time = resultSet_folder.getLong(resultSet_folder.getColumnIndex(FolderTableColumn.CreatedTime)) + let modified_time = resultSet_folder.getLong(resultSet_folder.getColumnIndex(FolderTableColumn.ModifiedTime)) + let folderData = new FolderData(id, name, uuid, color, folder_type, is_deleted, created_time, modified_time) + folderDataArray.push(folderData) + } + LogUtil.info(TAG, "query folder table success") + // query note + let columns_note = [] + let predicates_note = new ohosDataRdb.RdbPredicates(TableName.NoteTable) + let resultSet_note = await rdbStore.query(predicates_note, columns_note) + while (resultSet_note.goToNextRow()) { + let id = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.Id)) + let title = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Title)) + let uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Uuid)) + let folder_uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.FolderUuid)) + let content_text = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentText)) + let content_img = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentImg)) + let noteType = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.NoteType)) + let is_top = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsTop)) + let is_favorite = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsFavorite)) + let is_deleted = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsDeleted)) + let created_time = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.CreatedTime)) + let modified_time = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.ModifiedTime)) + let deleted_time = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.DeletedTime)) + let noteData = new NoteData(id, title, uuid, folder_uuid, content_text, content_img, noteType, is_top, is_favorite, is_deleted, created_time, modified_time, deleted_time) + noteDataArray.push(noteData) + } + LogUtil.info(TAG, "query note table success") + LogUtil.info(TAG, "folderDataArray[query] : " + folderDataArray.length) + for (let folderData of folderDataArray) { + LogUtil.info(TAG, "folderData[query] : " + JSON.stringify(folderData)) + } + LogUtil.info(TAG, "noteDataArray[query] : " + noteDataArray.length) + for (let noteData of noteDataArray) { + LogUtil.info(TAG, "noteData[query] : " + JSON.stringify(noteData)) + } + AppStorage.SetOrCreate('AllFolderArray', folderDataArray) + AppStorage.SetOrCreate('AllNoteArray', noteDataArray) + + // 迁移 + let isContinue = AppStorage.Get('IsContinue'); + LogUtil.info(TAG, "initAppStorage, isContinue is " + isContinue) + if (isContinue != undefined && isContinue == 1) { + console.info("RdbStoreUtil initAppStorage, IsContinue true") + let continueFolder: string = AppStorage.Get('ContinueFolder') + console.log("RdbStoreUtil initAppStorage, continueFolder is " + continueFolder) + let continueNote: string = AppStorage.Get('ContinueNote') + console.log("RdbStoreUtil initAppStorage, continueNote is " + continueNote) + let continueSection = AppStorage.Get('ContinueSection') + console.log("RdbStoreUtil initAppStorage, continueSection is " + continueSection) + + let folderObj = JSON.parse(continueFolder) + let folderData = new FolderData(folderObj.uuid, folderObj.name, folderObj.uuid, folderObj.color, + folderObj.folder_type, folderObj.is_deleted, folderObj.created_time, folderObj.modified_time) + + let noteObj = JSON.parse(continueNote) + let noteData = new NoteData(noteObj.uuid, noteObj.title, noteObj.uuid, noteObj.folder_uuid, + noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite, + noteObj.is_deleted, noteObj.created_time, noteObj.modified_time, noteObj.deleted_time) + + AppStorage.SetOrCreate('Folder', folderData) + AppStorage.SetOrCreate('Note', noteData) + AppStorage.SetOrCreate('Section', continueSection) + } else { + console.info("RdbStoreUtil initAppStorage, IsContinue false") + AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) + AppStorage.SetOrCreate('Note', AppStorage.Get('AllNoteArray')[0]) + AppStorage.SetOrCreate('Section', 3) + } + AppStorage.SetOrCreate('DBQueryFinished', 1) + LogUtil.info(TAG, "initAppStorage, set DBQueryFinished 1") + }) + .catch((err) => { + LogUtil.error(TAG, "initAppStorage, error : " + err) + }) + }, + + /** + * insert + * @param tableName + * @param valueBucket + * @param callback + */ + insert(tableName, valueBucket, callback) { + rdbStore.insert(tableName, valueBucket).then((rowId) => { + LogUtil.info(TAG, "insert success, rowId is " + rowId) + if (callback != null) { + callback(rowId) + } + }).catch((err) => { + LogUtil.error(TAG, "insert error : " + err) + }) + }, + + /** + * delete + * @param predicates + * @param callback + */ + delete(predicates, callback) { + rdbStore.delete(predicates).then((affectedRowCount) => { + LogUtil.info(TAG, "delete success, affectedRowCount is " + affectedRowCount) + if (callback != null) { + callback(affectedRowCount) + } + }).catch((err) => { + LogUtil.error(TAG, "delete error : " + err) + }) + }, + + /** + * update + * @param valueBucket + * @param predicates + * @param callback + */ + update(valueBucket, predicates, callback) { + rdbStore.update(valueBucket, predicates).then((affectedRowCount) => { + LogUtil.info(TAG, "update success, affectedRowCount is " + affectedRowCount) + if (callback != null) { + callback(affectedRowCount) + } + }).catch((err) => { + LogUtil.error(TAG, "update error : " + err) + }) + }, + + /** + * query + * @param columns + * @param predicates + * @param callback + */ + query(columns, predicates, callback) { + rdbStore.query(predicates, columns).then((resultSet) => { + LogUtil.info(TAG, "query success, row count : " + resultSet.rowCount) + if (callback != null) { + callback(resultSet) + } + }).catch((err) => { + LogUtil.error(TAG, "query error : " + err) + }) + }, + + /** + * get RdbPredicates by table name + * @param tableName + */ + getRdbPredicates(tableName) { + return new ohosDataRdb.RdbPredicates(tableName) + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/constants/StyleConstants.ets b/common/utils/src/main/ets/default/constants/StyleConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..22c8f672438cc807a1ebbdcffc7c259f170fbc9d --- /dev/null +++ b/common/utils/src/main/ets/default/constants/StyleConstants.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class StyleConstants { + public static PERCENTAGE_100: string = '100%' + public static PERCENTAGE_60: string = '60%' + public static PERCENTAGE_0: string = '0%' + public static SPACE_24: number = 24 + public static NOTE_LIST_BACKGROUND: string = "#f1f3f5" + public static DELETE_DEADLINE: number = 2592000000 // 30 days (30 * 24 * 60 * 60 * 1000)ms + public static OPACITY_10: number = 0.1 + public static OPACITY_20: number = 0.2 + public static OPACITY_40: number = 0.4 + public static OPACITY_100: number = 1 +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/NoteBaseData.ets b/common/utils/src/main/ets/default/model/NoteBaseData.ets new file mode 100644 index 0000000000000000000000000000000000000000..adc169ac82870e0a3c5d7d57b0e0832e9f1d8e65 --- /dev/null +++ b/common/utils/src/main/ets/default/model/NoteBaseData.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import NoteData from '../model/databaseModel/NoteData.ets' + +export const circleColorArray: string[] = [ + "#e84026", // 深红 + "#ff7500", // 浅红 + "#ffbf00", // 黄色 + "#41ba41", // 绿色 + "#00bfc9", // 浅蓝 + "#00aaee", // 中蓝 + "#3f56ea", // 深蓝 + "#8a2be2", // 紫色 +] +export const fontColorArray: string[] = [ + "#e84026", // 深红 + "#ffbf00", // 黄色 + "#41ba41", // 绿色 + "#00aaee", // 中蓝 + "#3f56ea", // 深蓝 + "#8a2be2", // 紫色 + "#182431", //黑色 +] + +export const unSelectedNoteBgColorMap = { + "#e84026": "#eecfcc", + "#ff7500": "#f3d9c4", + "#ffbf00": "#f3e8c4", + "#41ba41": "#cde7d1", + "#00bfc9": "#c0e8ec", + "#00aaee": "#c0e4f4", + "#3f56ea": "#cdd3f3", + "#8a2be2": "#dccbf1", + "#ffffff": "#ffffff" +} + +export const selectedNoteBgColorMap = { + "#e84026": "#eec4b8", + "#ff7500": "#f1d8c7", + "#ffbf00": "#f3cdb1", + "#41ba41": "#d1dabc", + "#00bfc9": "#c5dbd4", + "#00aaee": "#c5d7dc", + "#3f56ea": "#d1c8db", + "#8a2be2": "#dec1d9", + "#ffffff": "#19007dff" +} + +export const folderTextMap = { + "sys_def_allNotes_uuid": $r('app.string.allNotes'), + "sys_def_unClassified_uuid": $r('app.string.unClassified'), + "sys_def_myFavorites_uuid": $r('app.string.myFavorites'), + "sys_def_recentDeletes_uuid": $r('app.string.recentDeletes'), +} + +export const folderIconMap = { + "sys_def_allNotes_uuid": $r('app.media.allNotes'), + "sys_def_unClassified_uuid": $r('app.media.unClassified'), + "sys_def_myFavorites_uuid": $r('app.media.favorite_cancel'), + "sys_def_recentDeletes_uuid": $r('app.media.delete'), +} + +let CheckedNoteArray: NoteData[] = [] + +AppStorage.SetOrCreate('CheckedNoteArray', CheckedNoteArray) + +export class WidthWeightMessage { + folderListWeight: string // 三分栏每个分栏的比例, 用百分比表示 例如16% + folderListVisibility: number // 分栏的可见性 0:表示Visibility.None 1:表示Visibility.Visible + noteListWeight: string + noteListVisibility: number + noteCotentWeight: string + noteCotentVisibility: number + constructor(folderListWeight: string, folderListVisibility: number, noteListWeight: string, noteListVisibility: number, + noteCotentWeight: string, noteCotentVisibility: number) { + this.folderListWeight = folderListWeight + this.folderListVisibility = folderListVisibility + this.noteListWeight = noteListWeight + this.noteListVisibility = noteListVisibility + this.noteCotentWeight = noteCotentWeight + this.noteCotentVisibility = noteCotentVisibility + } +} + +let widthWeightOneSection: WidthWeightMessage = new WidthWeightMessage("0%", 0, "0%", 0, "100%", 1) +let widthWeightTwoSection = new WidthWeightMessage("0%", 0, "34%", 1, "66%", 1) +let widthWeightThreeSection = new WidthWeightMessage("16%", 1, "34%", 1, "50%", 1) +export const widthWeightMessageMap = { + 1: widthWeightOneSection, + 2: widthWeightTwoSection, + 3: widthWeightThreeSection +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a42fd075fab8f3f8f8ddd114e56a07395b55dac --- /dev/null +++ b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * 附件类 + */ +export default class AttachmentData { + id: number // 主键 + uuid: string // 唯一标识 + note_uuid: string // 笔记uuid + path: string // 路径 + attachment_type: number // 类型 + created_time: number // 创建时间 + modified_time: number // 修改时间 + + constructor(id: number, uuid: string, note_uuid: string, path: string, attachment_type: number, created_time: number, modified_time: number) { + this.id = id; + this.uuid = uuid; + this.note_uuid = note_uuid; + this.path = path; + this.attachment_type = attachment_type; + this.created_time = created_time; + this.modified_time = modified_time; + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets new file mode 100644 index 0000000000000000000000000000000000000000..8249041d6d907c1f1b19278f79d04f0cd5968375 --- /dev/null +++ b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets @@ -0,0 +1,211 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * table name + */ +export enum TableName { + FolderTable = "folder_table", + NoteTable = "note_table", + AttachmentTable = "attachment_table", + FormTable = "form_table" +} + +/** + * folder table column + */ +export enum FolderTableColumn { + Id = "id", // 主键 + Name = "name", // 名称 + Uuid = "uuid", // 唯一标识 + Color = "color", // 图标颜色 + FolderType = "folder_type", // 类型 + IsDeleted = "is_deleted", // 是否被删除 + CreatedTime = "created_time", // 创建时间 + ModifiedTime = "modified_time" // 修改时间 +} + +/** + * note table column + */ +export enum NoteTableColumn { + Id = "id", // 主键 + Title = "title", // 标题 + Uuid = "uuid", // 唯一标识 + FolderUuid = "folder_uuid", // 文件夹uuid + ContentText = "content_text", // 文字内容 + ContentImg = "content_img", // 图片路径 + NoteType = "note_type", // 类型 + IsTop = "is_top", // 是否置顶 + IsFavorite = "is_favorite", // 是否被收藏 + IsDeleted = "is_deleted", // 是否被删除 + CreatedTime = "created_time", // 创建时间 + ModifiedTime = "modified_time", // 修改时间 + DeletedTime = "deleted_time" // 删除时间 +} + +/** + * attachment table column + */ +export enum AttachmentTableColumn { + Id = "id", // 主键 + Uuid = "uuid", // 唯一标识 + NoteUuid = "note_uuid", // 笔记uuid + Path = "path", // 路径 + AttachmentType = "attachment_type", // 类型 + CreatedTime = "created_time", // 创建时间 + ModifiedTime = "modified_time" // 修改时间 +} + +/** + * form table column + */ +export enum FormTableColumn { + Id = "id", // 卡片id + Name = "name", // 卡片名称 + Dimension = "dimension", // 卡片尺寸 +} + +/** + * Database table init sql + */ +export enum TableSql { + FolderTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.FolderTable + " (" + + FolderTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT," + + FolderTableColumn.Name + " TEXT NOT NULL," + + FolderTableColumn.Uuid + " TEXT NOT NULL," + + FolderTableColumn.Color + " TEXT DEFAULT '#ffffffff'," + + FolderTableColumn.FolderType + " INTEGER DEFAULT 1," + + FolderTableColumn.IsDeleted + " INTEGER DEFAULT 0," + + FolderTableColumn.CreatedTime + " INTEGER," + + FolderTableColumn.ModifiedTime + " INTEGER" + + ")", + + NoteTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.NoteTable + " (" + + NoteTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT," + + NoteTableColumn.Title + " TEXT NOT NULL," + + NoteTableColumn.Uuid + " TEXT NOT NULL," + + NoteTableColumn.FolderUuid + " TEXT," + + NoteTableColumn.ContentText + " TEXT," + + NoteTableColumn.ContentImg + " TEXT," + + NoteTableColumn.NoteType + " INTEGER DEFAULT 1," + + NoteTableColumn.IsTop + " INTEGER DEFAULT 0," + + NoteTableColumn.IsFavorite + " INTEGER DEFAULT 0," + + NoteTableColumn.IsDeleted + " INTEGER DEFAULT 0," + + NoteTableColumn.CreatedTime + " INTEGER," + + NoteTableColumn.ModifiedTime + " INTEGER," + + NoteTableColumn.DeletedTime + " INTEGER" + + ")", + + AttachmentTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.AttachmentTable + " (" + + AttachmentTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT," + + AttachmentTableColumn.Uuid + " TEXT NOT NULL," + + AttachmentTableColumn.NoteUuid + " TEXT NOT NULL," + + AttachmentTableColumn.Path + " TEXT," + + AttachmentTableColumn.AttachmentType + " INTEGER DEFAULT 0," + + AttachmentTableColumn.CreatedTime + " INTEGER," + + AttachmentTableColumn.ModifiedTime + " INTEGER" + + ")", + + FormTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.FormTable + " (" + + FormTableColumn.Id + " TEXT NOT NULL," + + FormTableColumn.Name + " TEXT NOT NULL," + + FormTableColumn.Dimension + " TEXT NOT NULL" + + ")" +} + +/** + * system Define folder + */ +export enum SysDefFolder { + AllNotes = "sys_def_allNotes", + UnClassified = "sys_def_unClassified", + MyFavorites = "sys_def_myFavorites", + RecentDeletes = "sys_def_recentDeletes", + Personal = "sys_def_personal", + Life = "sys_def_life", + Work = "sys_def_work" +} + +/** + * system Define folder uuid + */ +export enum SysDefFolderUuid { + AllNotes = "sys_def_allNotes_uuid", + UnClassified = "sys_def_unClassified_uuid", + MyFavorites = "sys_def_myFavorites_uuid", + RecentDeletes = "sys_def_recentDeletes_uuid", + Personal = "sys_def_personal_uuid", + Life = "sys_def_life_uuid", + Work = "sys_def_work_uuid" +} + +/** + * folder type + */ +export enum FolderType { + SysDef, // System definition + CusDef, // User defined + FeatureDef // feature defined: MyFavorites & RecentDeletes +} + +/** + * note type + */ +export enum NoteType { + SysDef, + CusDef +} + +/** + * attachment type + */ +export enum AttachmentType { + Image, + Voice, + HandWriting +} + +/** + * Note favorite status + */ +export enum Favorite { + No, + Yes +} + +/** + * Note delete status + */ +export enum Delete { + No, + Yes +} + +/** + * Note top status + */ +export enum Top { + No, + Yes +} + +/** + * delete file type + */ +export enum DeleteFileType { + NoteData, + FolderData +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3fb9b5d431d467e3c09223da57903bdac34d95d --- /dev/null +++ b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FolderType, Delete} from './EnumData.ets' + +/** + * 文件夹类 + */ +export default class FolderData { + id: number // 主键 + name: string // 名称 + uuid: string // 唯一标识 + color: string // 图标颜色 + folder_type: FolderType // 类型 + is_deleted: Delete // 是否被删除 + created_time: number // 创建时间 + modified_time: number // 修改时间 + + constructor(id: number, name: string, uuid: string, color: string, folder_type: FolderType, + is_deleted: Delete, created_time: number, modified_time: number) { + this.id = id + this.name = name + this.uuid = uuid + this.color = color + this.folder_type = folder_type + this.is_deleted = is_deleted + this.created_time = created_time + this.modified_time = modified_time + } + + /** + * 转化为folder_table表的valueBucket + */ + toFolderObject(): any{ + return { + "name": this.name, + "uuid": this.uuid, + "color": this.color, + "folder_type": this.folder_type, + "is_deleted": this.is_deleted, + "created_time": this.created_time, + "modified_time": this.modified_time + } + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff646decea5956276ec3fafee20f6d0ef5649af7 --- /dev/null +++ b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {NoteType, Favorite, Delete, Top} from './EnumData.ets' + +/** + * 笔记类 + */ +export default class NoteData { + id: number // 主键 + title: string // 标题 + uuid: string // 唯一标识 + folder_uuid: string // 文件夹uuid + content_text: string // 文字内容 + content_img: string // 图片路径 + note_type: NoteType // 类型 + is_top: Top // 是否置顶 + is_favorite: Favorite // 是否被收藏 + is_deleted: Delete // 是否被删除 + created_time: number // 创建时间 + modified_time: number // 修改时间 + deleted_time: number // 删除时间 + + constructor(id: number, title: string, uuid: string, folder_uuid: string, content_text: string, content_img: string, + note_type: NoteType, is_top: Top, is_favorite: Favorite, is_deleted: Delete, created_time: number, + modified_time: number, deleted_time: number) { + this.id = id + this.title = title + this.uuid = uuid + this.folder_uuid = folder_uuid + this.content_text = content_text + this.content_img = content_img + this.note_type = note_type + this.is_top = is_top + this.is_favorite = is_favorite + this.is_deleted = is_deleted + this.created_time = created_time + this.modified_time = modified_time + this.deleted_time = deleted_time + } + + /** + * 转化为note_table表的valueBucket + */ + toNoteObject(): any{ + return { + "title": this.title, + "uuid": this.uuid, + "folder_uuid": this.folder_uuid, + "content_text": this.content_text, + "content_img": this.content_img, + "note_type": this.note_type, + "is_top": this.is_top, + "is_favorite": this.is_favorite, + "is_deleted": this.is_deleted, + "created_time": this.created_time, + "modified_time": this.modified_time, + "deleted_time": this.deleted_time + } + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets new file mode 100644 index 0000000000000000000000000000000000000000..22c3921db89ef246d276722e93b5d6994414cb56 --- /dev/null +++ b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets @@ -0,0 +1,175 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {SysDefFolder, SysDefFolderUuid, FolderType, NoteType, Favorite, Top, Delete} from './EnumData.ets' + +export default { + /** + * db info + */ + dbInfo: { + db_name: { + name: "note.db" // 数据库名称 + }, + db_verison: 1 // 数据库版本 + }, + + /** + * system defined folder + */ + sys_def_allNotes: { + "id": 1, + "name": SysDefFolder.AllNotes, + "uuid": SysDefFolderUuid.AllNotes, + "color": "#ffffff", + "folder_type": FolderType.SysDef, + "is_deleted": Delete.No, + "created_time": 1641863695000, + "modified_time": 1641863695000 + }, + + sys_def_unClassified: { + "id": 2, + "name": SysDefFolder.UnClassified, + "uuid": SysDefFolderUuid.UnClassified, + "color": "#ffffff", + "folder_type": FolderType.SysDef, + "is_deleted": Delete.No, + "created_time": 1641860095000, + "modified_time": 1641860095000 + }, + + sys_def_myFavorites: { + "id": 3, + "name": SysDefFolder.MyFavorites, + "uuid": SysDefFolderUuid.MyFavorites, + "color": "#ffffff", + "folder_type": FolderType.FeatureDef, + "is_deleted": Delete.No, + "created_time": 1641856088000, + "modified_time": 1641856088000 + }, + + sys_def_recentDeletes: { + "id": 4, + "name": SysDefFolder.RecentDeletes, + "uuid": SysDefFolderUuid.RecentDeletes, + "color": "#ffffff", + "folder_type": FolderType.FeatureDef, + "is_deleted": Delete.No, + "created_time": 1641848898000, + "modified_time": 1641848898000 + }, + + sys_def_personal: { + "id": 5, + "name": "个人", + "uuid": SysDefFolderUuid.Personal, + "color": "#41ba41", + "folder_type": FolderType.CusDef, + "is_deleted": Delete.No, + "created_time": 1641677288000, + "modified_time": 1641677288000 + }, + + sys_def_life: { + "id": 6, + "name": "生活", + "uuid": SysDefFolderUuid.Life, + "color": "#00aaee", + "folder_type": FolderType.CusDef, + "is_deleted": Delete.No, + "created_time": 1641676108000, + "modified_time": 1641676108000 + }, + + sys_def_work: { + "id": 7, + "name": "工作", + "uuid": SysDefFolderUuid.Work, + "color": "#e84026", + "folder_type": FolderType.CusDef, + "is_deleted": Delete.No, + "created_time": 1641636508000, + "modified_time": 1641636508000 + }, + + /** + * system defined note + */ + sys_def_note1: { + "id": 1, + "title": "数学公式", + "uuid": "note1_uuid", + "folder_uuid": SysDefFolderUuid.UnClassified, + "content_text": '好好学习,天天向上


', + "content_img": "/res/shuxue.png", + "note_type": NoteType.SysDef, + "is_top": Top.Yes, + "is_favorite": Favorite.Yes, + "is_deleted": Delete.No, + "created_time": 1641869573000, + "modified_time": 1641869573000, + "deleted_time": 0 + }, + + sys_def_note2: { + "id": 2, + "title": "UX会议纪要", + "uuid": "note2_uuid", + "folder_uuid": SysDefFolderUuid.Work, + "content_text": "UX会议纪要", + "content_img": "", + "note_type": NoteType.SysDef, + "is_top": Top.Yes, + "is_favorite": Favorite.No, + "is_deleted": Delete.No, + "created_time": 1640999288000, + "modified_time": 1640999288000, + "deleted_time": 0 + }, + + sys_def_note3: { + "id": 3, + "title": "旅游心得", + "uuid": "note3_uuid", + "folder_uuid": SysDefFolderUuid.Work, + "content_text": '旅游心得


', + "content_img": "/res/lvyou.png", + "note_type": NoteType.SysDef, + "is_top": Top.No, + "is_favorite": Favorite.No, + "is_deleted": Delete.No, + "created_time": 1641385708000, + "modified_time": 1641385708000, + "deleted_time": 0 + }, + + sys_def_note4: { + "id": 4, + "title": "蛋糕做法", + "uuid": "note4_uuid", + "folder_uuid": SysDefFolderUuid.Life, + "content_text": '蛋糕做法


', + "content_img": "/res/cake.png", + "note_type": NoteType.CusDef, + "is_top": Top.No, + "is_favorite": Favorite.Yes, + "is_deleted": Delete.No, + "created_time": 1640909288000, + "modified_time": 1640909288000, + "deleted_time": 0 + } +} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..077cdd5ae1373d9c55ca8a0cd29b25b33a4492f6 --- /dev/null +++ b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LogUtil from '../../baseUtil/LogUtil.ets' +import NoteData from '../../model/databaseModel/NoteData.ets' +import ohosDataRdb from '@ohos.data.rdb'; +import {TableName, NoteTableColumn} from '../../model/databaseModel/EnumData.ets' +import NoteUtil from '../../baseUtil/NoteUtil.ets' +import RdbStoreUtil from '../../baseUtil/RdbStoreUtil.ets' +import SysDefData from '../../model/databaseModel/SysDefData.ets' + +const TAG = "SearchModel" + +/** + * Search service class + */ +export class SearchModel { + private rdbStore; + + /** + * Search + * + * @param query - query content + */ + public async search(noteDataArray: NoteData[], query: string): Promise { + LogUtil.info(TAG, "query is " + query) + if (!query) { + LogUtil.info(TAG, "query is null") + return [] + } + let searchData: NoteData[] = []; + noteDataArray.forEach((noteData) => { + if (noteData.content_text.toLowerCase().indexOf(query.toLowerCase()) != -1 + || noteData.title.toLowerCase().indexOf(query.toLowerCase()) != -1) { + LogUtil.info(TAG, "uuid " + noteData.uuid) + searchData.push(noteData); + } + }) + // 排序 + return searchData; + } + + splitToHighlightText(text: string, highlightKeyword): any[] { + let spans: any[] = [] + var lowerSpans: string[] = text.toLowerCase().split(highlightKeyword.toLowerCase()) + var keywordStartIndex = 0 + var keywordLength = highlightKeyword.length + + for (var i = 0; i < lowerSpans.length; i++) { + var normalText = text.substr(keywordStartIndex, lowerSpans[i].length) + spans.push({ + type: 0, + text: normalText + }) + // if not at last, append highlight keyword + if (i != lowerSpans.length - 1) { + keywordStartIndex += lowerSpans[i].length + var keywordText = text.substr(keywordStartIndex, keywordLength) + spans.push({ + type: 1, + text: keywordText + }) + keywordStartIndex += keywordLength + } + } + + return spans + } +} + +let searchModel = new SearchModel() +export default searchModel as SearchModel \ No newline at end of file diff --git a/common/utils/src/main/resources/base/element/string.json b/common/utils/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bc3117340d6c286830ac771c0ecd196e5aa28907 --- /dev/null +++ b/common/utils/src/main/resources/base/element/string.json @@ -0,0 +1,4 @@ +{ + "string": [ + ] +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..be492496f9a20ac2d980ef4fc30061f4184c1c40 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,13 @@ +# Project-wide Gradle settings. +# IDE (e.g. DevEco Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# If the Chinese output is garbled, please configure the following parameter. +# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false. +# more information see https://docs.gradle.org/current/userguide/performance.html +# org.gradle.parallel=false +# org.gradle.jvmargs=-Dfile.encoding=GBK \ No newline at end of file diff --git a/gradlew b/gradlew new file mode 100644 index 0000000000000000000000000000000000000000..2fe81a7d95e4f9ad2c9b2a046707d36ceb3980b3 --- /dev/null +++ b/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,103 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{} diff --git a/product/pc/build.gradle b/product/pc/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..3f68c190541a39960797727e008d40ec805ea72f --- /dev/null +++ b/product/pc/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + defaultConfig { + compatibleSdkVersion 8 + } + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { +} diff --git a/product/pc/src/main/config.json b/product/pc/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5ea1c85ed546394e88178d9cb777204cb583bf33 --- /dev/null +++ b/product/pc/src/main/config.json @@ -0,0 +1,71 @@ +{ + "app": { + "bundleName": "com.ohos.note", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.note", + "name": ".MyApplication", + "mainAbility": "com.ohos.note.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "pc", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.ohos.note.MainAbility", + "icon": "$media:note", + "description": "$string:description_mainability", + "label":"$string:entry_MainAbility", + "type": "page", + "launchType": "singleton", + "srcPath": "MainAbility", + "srcLanguage": "ets", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme" + } + ] + } + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": "MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/product/pc/src/main/ets/MainAbility/app.ets b/product/pc/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fa46789d26d2239baaaf1d63b92d076a8a696c8 --- /dev/null +++ b/product/pc/src/main/ets/MainAbility/app.ets @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/product/pc/src/main/ets/MainAbility/pages/index.ets b/product/pc/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..63827718107518a838ab95454a9e69ffa1f9a41e --- /dev/null +++ b/product/pc/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/product/pc/src/main/resources/base/element/color.json b/product/pc/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..6e15ec2ea3f55bb0cd8814b91854e8a8d02f7ddf --- /dev/null +++ b/product/pc/src/main/resources/base/element/color.json @@ -0,0 +1,80 @@ +{ + "color": [ + { + "name": "color_ffffff", + "value": "#ffffff" + }, + { + "name": "delete_color_fa2a2d", + "value": "#fa2a2d" + }, + { + "name": "cancel_color_4fb4e3", + "value": "#4fb4e3" + }, + { + "name": "divider_color_e4e4e4", + "value": "#cce4e4e4" + }, + { + "name": "divider_color_182431", + "value": "#182431" + }, + { + "name": "button_color_419fff", + "value": "#419fff" + }, + { + "name": "button_color_fb4447", + "value": "#fb4447" + }, + { + "name": "text_color_3f97e9", + "value": "#3f97e9" + }, + { + "name": "text_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_182431", + "value": "#182431" + }, + { + "name": "folder_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_ffffff", + "value": "#ffffff" + }, + { + "name": "folder_color_19ffffff", + "value": "#19ffffff" + }, + { + "name": "folder_color_19182431", + "value": "#19182431" + }, + { + "name": "notecontent_color_ffffff", + "value": "#ffffff" + }, + { + "name": "notecontent_color_000000", + "value": "#000000" + }, + { + "name": "folderlist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_000000", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/product/pc/src/main/resources/base/element/float.json b/product/pc/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..fe803f0649fe2816669468a39f02622d8215da85 --- /dev/null +++ b/product/pc/src/main/resources/base/element/float.json @@ -0,0 +1,136 @@ +{ + "float": [ + { + "name": "wh_value_1", + "value": "1" + }, + { + "name": "wh_value_4", + "value": "4" + }, + { + "name": "wh_value_5", + "value": "5" + }, + { + "name": "wh_value_8", + "value": "8" + }, + { + "name": "wh_value_10", + "value": "10" + }, + { + "name": "wh_value_14", + "value": "14" + }, + { + "name": "wh_value_16", + "value": "16" + }, + { + "name": "wh_value_20", + "value": "20" + }, + { + "name": "wh_value_24", + "value": "24" + }, + { + "name": "wh_value_30", + "value": "30" + }, + { + "name": "wh_value_40", + "value": "40" + }, + { + "name": "wh_value_50", + "value": "50" + }, + { + "name": "wh_value_60", + "value": "60" + }, + { + "name": "wh_value_65", + "value": "65" + }, + { + "name": "wh_value_70", + "value": "70" + }, + { + "name": "wh_value_80", + "value": "80" + }, + { + "name": "wh_value_100", + "value": "100" + }, + { + "name": "wh_value_120", + "value": "120" + }, + { + "name": "wh_value_130", + "value": "1300" + }, + { + "name": "wh_value_160", + "value": "160" + }, + { + "name": "wh_value_230", + "value": "230" + }, + { + "name": "wh_value_280", + "value": "280" + }, + { + "name": "wh_value_390", + "value": "390" + }, + { + "name": "wh_value_400", + "value": "400" + }, + { + "name": "font_35", + "value": "35" + }, + { + "name": "font_15", + "value": "15" + }, + { + "name": "font_20", + "value": "20" + }, + { + "name": "font_25", + "value": "25" + }, + { + "name": "font_28", + "value": "28" + }, + { + "name": "font_50", + "value": "50" + }, + { + "name": "control_common_font_size", + "value": "20" + }, + { + "name": "slider_text_padding_left", + "value": "5" + }, + { + "name": "volume_border_radius", + "value": "15" + } + ] +} \ No newline at end of file diff --git a/product/pc/src/main/resources/base/element/string.json b/product/pc/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3b06a900c144024459b84a0b4f32a61d3b30d264 --- /dev/null +++ b/product/pc/src/main/resources/base/element/string.json @@ -0,0 +1,140 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "备忘录" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "note", + "value": "笔记" + }, + { + "name": "allNotes", + "value": "全部笔记" + }, + { + "name": "unClassified", + "value": "未分类" + }, + { + "name": "recentDeletes", + "value": "最近删除" + }, + { + "name": "myFavorites", + "value": "我的收藏" + }, + { + "name": "create", + "value": "新建" + }, + { + "name": "createFolder", + "value": "新建文件夹" + }, + { + "name": "editFolder", + "value": "编辑文件夹" + }, + { + "name": "deleteFolder", + "value": "删除文件夹" + }, + { + "name": "createNote", + "value": "新建笔记" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "save", + "value": "保存" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "name", + "value": "名称" + }, + { + "name": "delete_tips", + "value": "是否删除此文件夹及其中的内容?" + }, + { + "name": "deleteNote", + "value": "是否删除此笔记?" + }, + { + "name": "deleteNoteComplete", + "value": "此笔记将被永久删除,无法恢复。是否删除?" + }, + { + "name": "deleteAllNote", + "value": "是否删除全部笔记?" + }, + { + "name": "deletePartNote", + "value": "是否删除%d条笔记?" + }, + { + "name": "selected", + "value": "已选择%d项" + }, + { + "name": "none_selected", + "value": "未选择" + }, + { + "name": "noteslist", + "value": "条笔记" + }, + { + "name": "Empty_page", + "value": "没有笔记" + }, + { + "name": "searchNote", + "value": "搜索笔记" + }, + { + "name": "chooseFolder", + "value": "请选择文件夹" + }, + { + "name": "category_already_exist", + "value": "文件夹名称已存在" + }, + { + "name": "input_placeholder", + "value": "名称" + }, + { + "name": "permanently_delete_tips", + "value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除" + }, + { + "name": "set_top", + "value": "置顶" + }, + { + "name": "move", + "value": "移到" + }, + { + "name": "recover", + "value": "恢复" + }, + { + "name": "check_all", + "value": "多选" + } + ] +} \ No newline at end of file diff --git a/product/pc/src/main/resources/base/media/note.png b/product/pc/src/main/resources/base/media/note.png new file mode 100644 index 0000000000000000000000000000000000000000..9bbc1bbb7be8c51d2d734f59963894166a2e38e6 Binary files /dev/null and b/product/pc/src/main/resources/base/media/note.png differ diff --git a/product/phone/build.gradle b/product/phone/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..3f68c190541a39960797727e008d40ec805ea72f --- /dev/null +++ b/product/phone/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + defaultConfig { + compatibleSdkVersion 8 + } + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { +} diff --git a/product/phone/proguard-rules.pro b/product/phone/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/product/phone/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/product/phone/src/main/config.json b/product/phone/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..200e41dc3aa8c187e609e324cbb564ea4918a0cb --- /dev/null +++ b/product/phone/src/main/config.json @@ -0,0 +1,72 @@ +{ + "app": { + "bundleName": "com.ohos.note", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.note", + "name": ".MyApplication", + "mainAbility": "com.ohos.note.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "phone", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.ohos.note.MainAbility", + "icon": "$media:note", + "description": "$string:description_mainability", + "label":"$string:entry_MainAbility", + "type": "page", + "launchType": "singleton", + "srcPath": "MainAbility", + "srcLanguage": "ets", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme" + } + ] + } + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/MyNoteHome", + "pages/NoteHome" + ], + "name": "MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/app.ets b/product/phone/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..64e632597a8f872d1192a096c6c6e5da34738861 --- /dev/null +++ b/product/phone/src/main/ets/MainAbility/app.ets @@ -0,0 +1,17 @@ +import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' + +const TAG = "NoteApp" + +export default { + onCreate() { + LogUtil.info(TAG, "Application onCreate") + AppStorage.SetOrCreate('AllFolderArray', []) + AppStorage.SetOrCreate('AllNoteArray', []) + AppStorage.SetOrCreate('DBQueryFinished', 0) + LogUtil.info(TAG, "AppStorage SetOrCreate : AllFolderArray, AllNoteArray, DBQueryFinished") + }, + + onDestroy() { + LogUtil.info(TAG, 'Application onDestroy') + }, +} \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..77fc64d6b50368696b40d0e0f4c210e5067c83d9 --- /dev/null +++ b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fileio from '@ohos.fileio' +import {NoteHomeComp} from './NoteHome.ets' +import {NoteHomePortraitComp} from './NoteHomePortrait.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' + +@Entry +@Component +export struct MyNoteHomeComp { + @StorageLink('DBQueryFinished') dBQueryFinished: number = 0 + @Provide('PortraitModel') portraitModel:boolean = true + private context = getContext(this) + TAG = "MyNoteHomeComp" + + build() { + Flex() { + if (this.dBQueryFinished == 1) { + if (this.portraitModel == true){ + NoteHomePortraitComp() + } else { + NoteHomeComp() + } + } + } + .width('100%').height('100%') + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + + if (this.context == undefined || this.context == null) { + LogUtil.error(this.TAG, "context is error") + return + } + + LogUtil.info(this.TAG, "databaseDir is " + this.context.databaseDir) + // /data/storage/el2/database/tablet + + let dbPath = "/data/app/el2/100/database/com.ohos.note/phone/db/note.db" + try { + if (fileio.accessSync(dbPath) == undefined) { + LogUtil.info(this.TAG, "db has created") + RdbStoreUtil.initAppStorage(this.context) + } + } catch (err) { + LogUtil.info(this.TAG, "db has not created, start to create db") + RdbStoreUtil.createRdbStore(this.context) + } + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..45c5ec0c8588ed354480e93d4bb6265e92484923 --- /dev/null +++ b/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' +import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' +import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' +import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' +import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {SysDefFolderUuid} from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import LayoutUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets' +import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' + +@Entry +@Component +export struct NoteHomeComp { + @Provide('RefreshFlag') refreshFlag: number = 0 + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + + // 当前文件夹、笔记、分栏 + @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') + @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section'); + + @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; + @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 + @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 + @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 + @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 + + TAG = "NoteHomeComp" + + build() { + Flex({ justifyContent: FlexAlign.Start }) { + // Folder list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { + FolderListComp() + } + .flexShrink(0) + .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).folderListWeight) + .height(StyleConstants.PERCENTAGE_100) + .visibility( + LayoutUtil.getWidthWeightMessage(this.sectionStatus) + .folderListVisibility == 0 ? Visibility.None : Visibility.Visible) + .opacity(this.search ? StyleConstants.OPACITY_40 : StyleConstants.OPACITY_100) + .enabled(this.search ? false : true) + + Divider() + .vertical(true) + .strokeWidth(1) + .color($r("app.color.divider_color_182431")) + .height("100%") + .opacity(StyleConstants.OPACITY_10) + // Note list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteListComp() + } + .flexShrink(0) + .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteListWeight) + .height(StyleConstants.PERCENTAGE_100) + .visibility( + LayoutUtil.getWidthWeightMessage(this.sectionStatus) + .noteListVisibility == 0 ? Visibility.None : Visibility.Visible); + Divider() + .vertical(true) + .strokeWidth(1) + .color($r("app.color.divider_color_182431")) + .height("100%") + .opacity(StyleConstants.OPACITY_10) + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContentComp() + } + .flexShrink(0) + .backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notecontent_color_ffffff")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight) + .height(StyleConstants.PERCENTAGE_100) + .opacity(this.longpress ? StyleConstants.OPACITY_40 : this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_20 : StyleConstants.OPACITY_100) + .enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true) + } + .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets new file mode 100644 index 0000000000000000000000000000000000000000..9424d77e47f41699d9327ae8d4e50889e0c7e751 --- /dev/null +++ b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' +import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' +import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' +import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' +import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' + +@Entry +@Component +export struct NoteHomePortraitComp { + @Provide('RefreshFlag') refreshFlag: number = 0 + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + + // 当前文件夹、笔记、分栏 + @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') + @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section'); + + @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; + @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 + @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = false // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 + @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 + @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 + + TAG = "NoteHomeComp" + + build() { + Stack({ alignContent: Alignment.Start }) { + + // Note list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteListComp() + } + .width(StyleConstants.PERCENTAGE_100) + .height(StyleConstants.PERCENTAGE_100) + .enabled(this.expandStatus ? false : true) + + //Folder list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { + FolderListComp() + } + .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) + .width(StyleConstants.PERCENTAGE_60) + .height(StyleConstants.PERCENTAGE_100) + .visibility(this.expandStatus == false ? Visibility.None:Visibility.Visible) + + + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContentComp() + } + .backgroundColor($r("app.color.notecontent_color_ffffff")) + .width(StyleConstants.PERCENTAGE_100) + .height(StyleConstants.PERCENTAGE_100) + .visibility(this.chooseNote == false ? Visibility.None:Visibility.Visible) + } + .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/res/cake.png b/product/phone/src/main/ets/MainAbility/res/cake.png new file mode 100644 index 0000000000000000000000000000000000000000..e56343fb562b5c1e5470707abfe4e65979939418 Binary files /dev/null and b/product/phone/src/main/ets/MainAbility/res/cake.png differ diff --git a/product/phone/src/main/ets/MainAbility/res/lvyou.png b/product/phone/src/main/ets/MainAbility/res/lvyou.png new file mode 100644 index 0000000000000000000000000000000000000000..5a4c05f0a9afbf6479b50155db28aaf49ba36e2e Binary files /dev/null and b/product/phone/src/main/ets/MainAbility/res/lvyou.png differ diff --git a/product/phone/src/main/ets/MainAbility/res/shuxue.png b/product/phone/src/main/ets/MainAbility/res/shuxue.png new file mode 100644 index 0000000000000000000000000000000000000000..8af342a8d6b761f78c9e28f8a3bf1d84ead54ba4 Binary files /dev/null and b/product/phone/src/main/ets/MainAbility/res/shuxue.png differ diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..69a86f115b5f4e3746b6dc8b506c02937c823e12 --- /dev/null +++ b/product/phone/src/main/resources/base/element/color.json @@ -0,0 +1,92 @@ +{ + "color": [ + { + "name": "color_ffffff", + "value": "#ffffff" + }, + { + "name": "color_fffffB", + "value": "#FFFBFBFB" + }, + { + "name": "delete_color_fa2a2d", + "value": "#fa2a2d" + }, + { + "name": "cancel_color_4fb4e3", + "value": "#4fb4e3" + }, + { + "name": "divider_color_e4e4e4", + "value": "#cce4e4e4" + }, + { + "name": "divider_color_182431", + "value": "#182431" + }, + { + "name": "button_color_419fff", + "value": "#419fff" + }, + { + "name": "button_color_fb4447", + "value": "#fb4447" + }, + { + "name": "text_color_3f97e9", + "value": "#3f97e9" + }, + { + "name": "text_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_182431", + "value": "#182431" + }, + { + "name": "folder_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_ffffff", + "value": "#ffffff" + }, + { + "name": "folder_color_19ffffff", + "value": "#19ffffff" + }, + { + "name": "folder_color_19182431", + "value": "#19182431" + }, + { + "name": "notecontent_color_ffffff", + "value": "#ffffff" + }, + { + "name": "notecontent_color_000000", + "value": "#000000" + }, + { + "name": "folderlist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_000000", + "value": "#000000" + }, + { + "name": "image_bordercolor_19182431", + "value": "#19182431" + }, + { + "name": "button_color_f86d05", + "value": "#f86d05" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/float.json b/product/phone/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..fe803f0649fe2816669468a39f02622d8215da85 --- /dev/null +++ b/product/phone/src/main/resources/base/element/float.json @@ -0,0 +1,136 @@ +{ + "float": [ + { + "name": "wh_value_1", + "value": "1" + }, + { + "name": "wh_value_4", + "value": "4" + }, + { + "name": "wh_value_5", + "value": "5" + }, + { + "name": "wh_value_8", + "value": "8" + }, + { + "name": "wh_value_10", + "value": "10" + }, + { + "name": "wh_value_14", + "value": "14" + }, + { + "name": "wh_value_16", + "value": "16" + }, + { + "name": "wh_value_20", + "value": "20" + }, + { + "name": "wh_value_24", + "value": "24" + }, + { + "name": "wh_value_30", + "value": "30" + }, + { + "name": "wh_value_40", + "value": "40" + }, + { + "name": "wh_value_50", + "value": "50" + }, + { + "name": "wh_value_60", + "value": "60" + }, + { + "name": "wh_value_65", + "value": "65" + }, + { + "name": "wh_value_70", + "value": "70" + }, + { + "name": "wh_value_80", + "value": "80" + }, + { + "name": "wh_value_100", + "value": "100" + }, + { + "name": "wh_value_120", + "value": "120" + }, + { + "name": "wh_value_130", + "value": "1300" + }, + { + "name": "wh_value_160", + "value": "160" + }, + { + "name": "wh_value_230", + "value": "230" + }, + { + "name": "wh_value_280", + "value": "280" + }, + { + "name": "wh_value_390", + "value": "390" + }, + { + "name": "wh_value_400", + "value": "400" + }, + { + "name": "font_35", + "value": "35" + }, + { + "name": "font_15", + "value": "15" + }, + { + "name": "font_20", + "value": "20" + }, + { + "name": "font_25", + "value": "25" + }, + { + "name": "font_28", + "value": "28" + }, + { + "name": "font_50", + "value": "50" + }, + { + "name": "control_common_font_size", + "value": "20" + }, + { + "name": "slider_text_padding_left", + "value": "5" + }, + { + "name": "volume_border_radius", + "value": "15" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/string.json b/product/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..db8ce11e572309263e645787c051e29aeb95981f --- /dev/null +++ b/product/phone/src/main/resources/base/element/string.json @@ -0,0 +1,144 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "备忘录" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "note", + "value": "笔记" + }, + { + "name": "allNotes", + "value": "全部笔记" + }, + { + "name": "unClassified", + "value": "未分类" + }, + { + "name": "recentDeletes", + "value": "最近删除" + }, + { + "name": "myFavorites", + "value": "我的收藏" + }, + { + "name": "create", + "value": "新建" + }, + { + "name": "createFolder", + "value": "新建文件夹" + }, + { + "name": "editFolder", + "value": "编辑文件夹" + }, + { + "name": "deleteFolder", + "value": "删除文件夹" + }, + { + "name": "createNote", + "value": "新建笔记" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "save", + "value": "保存" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "name", + "value": "名称" + }, + { + "name": "delete_tips", + "value": "是否删除此文件夹及其中的内容?" + }, + { + "name": "deleteNote", + "value": "是否删除此笔记?" + }, + { + "name": "deleteNoteComplete", + "value": "此笔记将被永久删除,无法恢复。是否删除?" + }, + { + "name": "deleteAllNote", + "value": "是否删除全部笔记?" + }, + { + "name": "deletePartNote", + "value": "是否删除%d条笔记?" + }, + { + "name": "selected", + "value": "已选择%d项" + }, + { + "name": "none_selected", + "value": "未选择" + }, + { + "name": "noteslist", + "value": "条笔记" + }, + { + "name": "Empty_page", + "value": "没有笔记" + }, + { + "name": "searchNote", + "value": "搜索笔记" + }, + { + "name": "chooseFolder", + "value": "请选择文件夹" + }, + { + "name": "category_already_exist", + "value": "文件夹名称已存在" + }, + { + "name": "input_placeholder", + "value": "名称" + }, + { + "name": "permanently_delete_tips", + "value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除" + }, + { + "name": "set_top", + "value": "置顶" + }, + { + "name": "move", + "value": "移到" + }, + { + "name": "recover", + "value": "恢复" + }, + { + "name": "check_all", + "value": "多选" + }, + { + "name": "editNoteTitle", + "value": "修改标题" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/action_bold.svg b/product/phone/src/main/resources/base/media/action_bold.svg new file mode 100644 index 0000000000000000000000000000000000000000..5dd179bf754ea76483fe060fe557c5f90555b007 --- /dev/null +++ b/product/phone/src/main/resources/base/media/action_bold.svg @@ -0,0 +1 @@ +文本粗细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/addNote.svg b/product/phone/src/main/resources/base/media/addNote.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cbab4ecaf96539318d40d08f89a20d53b83fd68 --- /dev/null +++ b/product/phone/src/main/resources/base/media/addNote.svg @@ -0,0 +1 @@ +加-细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/allNotes.svg b/product/phone/src/main/resources/base/media/allNotes.svg new file mode 100644 index 0000000000000000000000000000000000000000..0bd2d8c13393463d11359016cbe466a58eebebb1 --- /dev/null +++ b/product/phone/src/main/resources/base/media/allNotes.svg @@ -0,0 +1 @@ +笔记 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/back.svg b/product/phone/src/main/resources/base/media/back.svg new file mode 100644 index 0000000000000000000000000000000000000000..95e1f5dcafef66bc67faefd4f4236d967fb2bf1e --- /dev/null +++ b/product/phone/src/main/resources/base/media/back.svg @@ -0,0 +1 @@ +back \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/back_1.svg b/product/phone/src/main/resources/base/media/back_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..95e1f5dcafef66bc67faefd4f4236d967fb2bf1e --- /dev/null +++ b/product/phone/src/main/resources/base/media/back_1.svg @@ -0,0 +1 @@ +back \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/camera.svg b/product/phone/src/main/resources/base/media/camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..cd8fa1b37fe8d7a9101420824508ca3f799cc73d --- /dev/null +++ b/product/phone/src/main/resources/base/media/camera.svg @@ -0,0 +1 @@ +相机 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/check_all.svg b/product/phone/src/main/resources/base/media/check_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..64922fddec736eb05e633d31ea2e66084e810941 --- /dev/null +++ b/product/phone/src/main/resources/base/media/check_all.svg @@ -0,0 +1 @@ +全选 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/check_all1.svg b/product/phone/src/main/resources/base/media/check_all1.svg new file mode 100644 index 0000000000000000000000000000000000000000..34d884faffc40e149704c6fb009ebacb64a4f34e --- /dev/null +++ b/product/phone/src/main/resources/base/media/check_all1.svg @@ -0,0 +1,13 @@ + + + + + 全选 + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/checked.svg b/product/phone/src/main/resources/base/media/checked.svg new file mode 100644 index 0000000000000000000000000000000000000000..32708c95c6538825b3270d4684ca3c19942af6d2 --- /dev/null +++ b/product/phone/src/main/resources/base/media/checked.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + +选中后 + + + + + + + + + + + diff --git a/product/phone/src/main/resources/base/media/choose_all.svg b/product/phone/src/main/resources/base/media/choose_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..64922fddec736eb05e633d31ea2e66084e810941 --- /dev/null +++ b/product/phone/src/main/resources/base/media/choose_all.svg @@ -0,0 +1 @@ +全选 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/circle_tick.svg b/product/phone/src/main/resources/base/media/circle_tick.svg new file mode 100644 index 0000000000000000000000000000000000000000..10eba81489c855357a5a9188ce84923b2dd8d630 --- /dev/null +++ b/product/phone/src/main/resources/base/media/circle_tick.svg @@ -0,0 +1 @@ +文本扫描 对勾 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/circle_tick1.svg b/product/phone/src/main/resources/base/media/circle_tick1.svg new file mode 100644 index 0000000000000000000000000000000000000000..295c58cfd197dbb0042035563e8970ba60268b3c --- /dev/null +++ b/product/phone/src/main/resources/base/media/circle_tick1.svg @@ -0,0 +1 @@ +文档扫描 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/cross.svg b/product/phone/src/main/resources/base/media/cross.svg new file mode 100644 index 0000000000000000000000000000000000000000..c4a4e0fa6db0fc09a6183dcd28944bc14544ff51 --- /dev/null +++ b/product/phone/src/main/resources/base/media/cross.svg @@ -0,0 +1 @@ +叉-粗 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/cross_thick.svg b/product/phone/src/main/resources/base/media/cross_thick.svg new file mode 100644 index 0000000000000000000000000000000000000000..c4a4e0fa6db0fc09a6183dcd28944bc14544ff51 --- /dev/null +++ b/product/phone/src/main/resources/base/media/cross_thick.svg @@ -0,0 +1 @@ +叉-粗 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/cross_thin.svg b/product/phone/src/main/resources/base/media/cross_thin.svg new file mode 100644 index 0000000000000000000000000000000000000000..6373a780e0205927ce0676b25603b1ac3f3da0bf --- /dev/null +++ b/product/phone/src/main/resources/base/media/cross_thin.svg @@ -0,0 +1 @@ +叉-细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/cycle_thin1.svg b/product/phone/src/main/resources/base/media/cycle_thin1.svg new file mode 100644 index 0000000000000000000000000000000000000000..1fc2cba67ff00b50e6e8975c2ce355fe9925f513 --- /dev/null +++ b/product/phone/src/main/resources/base/media/cycle_thin1.svg @@ -0,0 +1 @@ +cycle-细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/delete.svg b/product/phone/src/main/resources/base/media/delete.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f1c1fb0fe0a5f265cb70d4a5f5163c9360b934d --- /dev/null +++ b/product/phone/src/main/resources/base/media/delete.svg @@ -0,0 +1 @@ +删除 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/delete1.svg b/product/phone/src/main/resources/base/media/delete1.svg new file mode 100644 index 0000000000000000000000000000000000000000..c97adea0c568fbf9033a511049456f04c43d8e38 --- /dev/null +++ b/product/phone/src/main/resources/base/media/delete1.svg @@ -0,0 +1 @@ +删除-实心 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/delete2.svg b/product/phone/src/main/resources/base/media/delete2.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f1c1fb0fe0a5f265cb70d4a5f5163c9360b934d --- /dev/null +++ b/product/phone/src/main/resources/base/media/delete2.svg @@ -0,0 +1 @@ +删除 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/emptyPage.svg b/product/phone/src/main/resources/base/media/emptyPage.svg new file mode 100644 index 0000000000000000000000000000000000000000..a0e85ddd28ab287cbdb667dff4a9be0604322c35 --- /dev/null +++ b/product/phone/src/main/resources/base/media/emptyPage.svg @@ -0,0 +1,47 @@ + + + + +笔记空页面 + + + + + + + + + + + + + diff --git a/product/phone/src/main/resources/base/media/favorite.svg b/product/phone/src/main/resources/base/media/favorite.svg new file mode 100644 index 0000000000000000000000000000000000000000..b3d1e16d6c382e8bdaff495a17c78b28b6e2b8ea --- /dev/null +++ b/product/phone/src/main/resources/base/media/favorite.svg @@ -0,0 +1 @@ +收藏-实心 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/favorite_cancel.svg b/product/phone/src/main/resources/base/media/favorite_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..c7d09d60a002714a157efe03f0e12d36bff2e50d --- /dev/null +++ b/product/phone/src/main/resources/base/media/favorite_cancel.svg @@ -0,0 +1,30 @@ + + + + +收藏(线性) + + diff --git a/product/phone/src/main/resources/base/media/foldMove_select.svg b/product/phone/src/main/resources/base/media/foldMove_select.svg new file mode 100644 index 0000000000000000000000000000000000000000..6b7b9d104f70c7c42cf1b55968c2741c7bb8d2b6 --- /dev/null +++ b/product/phone/src/main/resources/base/media/foldMove_select.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + +选中 + + + + + + + + + + + diff --git a/product/phone/src/main/resources/base/media/foldMove_unselect.svg b/product/phone/src/main/resources/base/media/foldMove_unselect.svg new file mode 100644 index 0000000000000000000000000000000000000000..3b9a209f812946604093d6727483a391cb1243ed --- /dev/null +++ b/product/phone/src/main/resources/base/media/foldMove_unselect.svg @@ -0,0 +1,18 @@ + + + + +未选中 + + + + + + + diff --git a/product/phone/src/main/resources/base/media/folder.svg b/product/phone/src/main/resources/base/media/folder.svg new file mode 100644 index 0000000000000000000000000000000000000000..f5c0bc08ff85e314c7806dc78f72407131314c63 --- /dev/null +++ b/product/phone/src/main/resources/base/media/folder.svg @@ -0,0 +1 @@ +文件夹 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/font_color.svg b/product/phone/src/main/resources/base/media/font_color.svg new file mode 100644 index 0000000000000000000000000000000000000000..70ee9eddca2cb58df50a7742e52266781991eda4 --- /dev/null +++ b/product/phone/src/main/resources/base/media/font_color.svg @@ -0,0 +1 @@ +文本颜色 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/font_large.svg b/product/phone/src/main/resources/base/media/font_large.svg new file mode 100644 index 0000000000000000000000000000000000000000..82436a95668ffef786c2ba83cbcdeca7d42bf379 --- /dev/null +++ b/product/phone/src/main/resources/base/media/font_large.svg @@ -0,0 +1,10 @@ + + + + +字体大小备份 2 + + diff --git a/product/phone/src/main/resources/base/media/font_size.svg b/product/phone/src/main/resources/base/media/font_size.svg new file mode 100644 index 0000000000000000000000000000000000000000..90b068c2b1d6e14a3921fc9e544fc9b6d3c1cd3a --- /dev/null +++ b/product/phone/src/main/resources/base/media/font_size.svg @@ -0,0 +1,15 @@ + + + + +字体大小 + + diff --git a/product/phone/src/main/resources/base/media/font_small.svg b/product/phone/src/main/resources/base/media/font_small.svg new file mode 100644 index 0000000000000000000000000000000000000000..1a77926bea52bc1c2df79ab49ed4d6f6619968a5 --- /dev/null +++ b/product/phone/src/main/resources/base/media/font_small.svg @@ -0,0 +1,10 @@ + + + + +字体大小备份 + + diff --git a/product/phone/src/main/resources/base/media/font_style.svg b/product/phone/src/main/resources/base/media/font_style.svg new file mode 100644 index 0000000000000000000000000000000000000000..1b57f3f4f17636a8edecf12110fd521437b8ff19 --- /dev/null +++ b/product/phone/src/main/resources/base/media/font_style.svg @@ -0,0 +1 @@ +文本样式 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/format_italic.svg b/product/phone/src/main/resources/base/media/format_italic.svg new file mode 100644 index 0000000000000000000000000000000000000000..7695394d1b41e9584ac56aa63a84b62d4d7baa6f --- /dev/null +++ b/product/phone/src/main/resources/base/media/format_italic.svg @@ -0,0 +1 @@ +文本倾斜 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/format_menubullte1.svg b/product/phone/src/main/resources/base/media/format_menubullte1.svg new file mode 100644 index 0000000000000000000000000000000000000000..26b7cc4b005dacef2d268e5d8d3c838b4754001b --- /dev/null +++ b/product/phone/src/main/resources/base/media/format_menubullte1.svg @@ -0,0 +1 @@ +符号标注2 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/format_menubullte2.svg b/product/phone/src/main/resources/base/media/format_menubullte2.svg new file mode 100644 index 0000000000000000000000000000000000000000..ebf9a2af47457da77e99256e7005ef808514f87d --- /dev/null +++ b/product/phone/src/main/resources/base/media/format_menubullte2.svg @@ -0,0 +1 @@ +符号标注3 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/format_menulist_alphabet.svg b/product/phone/src/main/resources/base/media/format_menulist_alphabet.svg new file mode 100644 index 0000000000000000000000000000000000000000..efc97ae0786bd98c7d0c91d975d1f52791ed3c5c --- /dev/null +++ b/product/phone/src/main/resources/base/media/format_menulist_alphabet.svg @@ -0,0 +1 @@ +英文符号 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/format_menulist_number.svg b/product/phone/src/main/resources/base/media/format_menulist_number.svg new file mode 100644 index 0000000000000000000000000000000000000000..6e778c04311ba5712e24f99260bc6635af620115 --- /dev/null +++ b/product/phone/src/main/resources/base/media/format_menulist_number.svg @@ -0,0 +1 @@ +数字符号 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/huaweishare1.svg b/product/phone/src/main/resources/base/media/huaweishare1.svg new file mode 100644 index 0000000000000000000000000000000000000000..a5879634a21ef9f48552f2fae3bebeca20774ede --- /dev/null +++ b/product/phone/src/main/resources/base/media/huaweishare1.svg @@ -0,0 +1 @@ +huaweishare \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/icon.png b/product/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/product/phone/src/main/resources/base/media/icon.png differ diff --git a/product/phone/src/main/resources/base/media/left_justify.svg b/product/phone/src/main/resources/base/media/left_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..93e982c063728669cba5f2294a4fde439cb6a894 --- /dev/null +++ b/product/phone/src/main/resources/base/media/left_justify.svg @@ -0,0 +1 @@ +左对齐 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/location_notify.svg b/product/phone/src/main/resources/base/media/location_notify.svg new file mode 100644 index 0000000000000000000000000000000000000000..44a24c02e2ad637aa4cd70152ee80a8944ae80e2 --- /dev/null +++ b/product/phone/src/main/resources/base/media/location_notify.svg @@ -0,0 +1 @@ +位置提醒 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/mid_justify.svg b/product/phone/src/main/resources/base/media/mid_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..499b42cc4ee9cadb7dd5614c9eea6048da8ac001 --- /dev/null +++ b/product/phone/src/main/resources/base/media/mid_justify.svg @@ -0,0 +1 @@ +居中 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/minus.svg b/product/phone/src/main/resources/base/media/minus.svg new file mode 100644 index 0000000000000000000000000000000000000000..fd73046a41f74fb199dd204695333487fb74b00d --- /dev/null +++ b/product/phone/src/main/resources/base/media/minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/more_1.svg b/product/phone/src/main/resources/base/media/more_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..76b19e9a6cf6b6f369d96e233804bcf8a863b824 --- /dev/null +++ b/product/phone/src/main/resources/base/media/more_1.svg @@ -0,0 +1 @@ +more \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/more_list1.svg b/product/phone/src/main/resources/base/media/more_list1.svg new file mode 100644 index 0000000000000000000000000000000000000000..beaecc56efd1efef11052740cd383fdd96be8e8d --- /dev/null +++ b/product/phone/src/main/resources/base/media/more_list1.svg @@ -0,0 +1 @@ +more-list \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/move.svg b/product/phone/src/main/resources/base/media/move.svg new file mode 100644 index 0000000000000000000000000000000000000000..510e493857cf016df3ac988cf3e81e6a22ac6a9c --- /dev/null +++ b/product/phone/src/main/resources/base/media/move.svg @@ -0,0 +1 @@ +移动 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/multi_choose.svg b/product/phone/src/main/resources/base/media/multi_choose.svg new file mode 100644 index 0000000000000000000000000000000000000000..5a6c7582eca673c066ebe267ec8ff7743cef8335 --- /dev/null +++ b/product/phone/src/main/resources/base/media/multi_choose.svg @@ -0,0 +1 @@ +多选 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/note.png b/product/phone/src/main/resources/base/media/note.png new file mode 100644 index 0000000000000000000000000000000000000000..fd48594285247f23b6d4b50400064f34d39c8a5e Binary files /dev/null and b/product/phone/src/main/resources/base/media/note.png differ diff --git a/product/phone/src/main/resources/base/media/pic_choose.svg b/product/phone/src/main/resources/base/media/pic_choose.svg new file mode 100644 index 0000000000000000000000000000000000000000..ceb230fc0da6be2f7f3c0e6f56b6474efbf88145 --- /dev/null +++ b/product/phone/src/main/resources/base/media/pic_choose.svg @@ -0,0 +1 @@ +复制图片 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/picture_dark.svg b/product/phone/src/main/resources/base/media/picture_dark.svg new file mode 100644 index 0000000000000000000000000000000000000000..3f97504693b872a97c15e073dbed9cedd4fe824b --- /dev/null +++ b/product/phone/src/main/resources/base/media/picture_dark.svg @@ -0,0 +1 @@ +图片-实心 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/picture_white.svg b/product/phone/src/main/resources/base/media/picture_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..1def639bcda5ff67fcfbf296417597dc88a2455f --- /dev/null +++ b/product/phone/src/main/resources/base/media/picture_white.svg @@ -0,0 +1 @@ +图片 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/recover.svg b/product/phone/src/main/resources/base/media/recover.svg new file mode 100644 index 0000000000000000000000000000000000000000..c0ce26aa75c3bf57305c2253bcd43e87afa407d7 --- /dev/null +++ b/product/phone/src/main/resources/base/media/recover.svg @@ -0,0 +1,14 @@ + + + + +恢复 + + diff --git a/product/phone/src/main/resources/base/media/refresh.svg b/product/phone/src/main/resources/base/media/refresh.svg new file mode 100644 index 0000000000000000000000000000000000000000..13823368c3237daf74c3ae1cfe00e39da86bd383 --- /dev/null +++ b/product/phone/src/main/resources/base/media/refresh.svg @@ -0,0 +1 @@ +刷新 细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/right_justify.svg b/product/phone/src/main/resources/base/media/right_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..e43328281277316793c51ec94faf9aeb9e702791 --- /dev/null +++ b/product/phone/src/main/resources/base/media/right_justify.svg @@ -0,0 +1 @@ +右对齐 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/save.svg b/product/phone/src/main/resources/base/media/save.svg new file mode 100644 index 0000000000000000000000000000000000000000..78d5245d0c330a3710bdec6ae4be026b454e1508 --- /dev/null +++ b/product/phone/src/main/resources/base/media/save.svg @@ -0,0 +1 @@ +储存 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/search.svg b/product/phone/src/main/resources/base/media/search.svg new file mode 100644 index 0000000000000000000000000000000000000000..2dae1c554b597d9f0a67197fa44330c072dfd606 --- /dev/null +++ b/product/phone/src/main/resources/base/media/search.svg @@ -0,0 +1,13 @@ + + + + +搜索 + + diff --git a/product/phone/src/main/resources/base/media/search_note.svg b/product/phone/src/main/resources/base/media/search_note.svg new file mode 100644 index 0000000000000000000000000000000000000000..550d83197b1594240db1609fd62749e60c5e8f64 --- /dev/null +++ b/product/phone/src/main/resources/base/media/search_note.svg @@ -0,0 +1 @@ +搜索 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/set_top.svg b/product/phone/src/main/resources/base/media/set_top.svg new file mode 100644 index 0000000000000000000000000000000000000000..f79d2d7076ed275b3efe5cae46817808d41882c0 --- /dev/null +++ b/product/phone/src/main/resources/base/media/set_top.svg @@ -0,0 +1 @@ +置顶 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/share.svg b/product/phone/src/main/resources/base/media/share.svg new file mode 100644 index 0000000000000000000000000000000000000000..e767312fa8241aa3bb36b5436f6c72be95a96956 --- /dev/null +++ b/product/phone/src/main/resources/base/media/share.svg @@ -0,0 +1 @@ +分享 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/styles.svg b/product/phone/src/main/resources/base/media/styles.svg new file mode 100644 index 0000000000000000000000000000000000000000..4fb5bb6b99656b56ce68627725d165454ba477bc --- /dev/null +++ b/product/phone/src/main/resources/base/media/styles.svg @@ -0,0 +1,11 @@ + + + +样式 + + diff --git a/product/phone/src/main/resources/base/media/suojin.svg b/product/phone/src/main/resources/base/media/suojin.svg new file mode 100644 index 0000000000000000000000000000000000000000..6dca6e103a6de3216b34f20dc9f4453f5bd2d3e6 --- /dev/null +++ b/product/phone/src/main/resources/base/media/suojin.svg @@ -0,0 +1 @@ +缩进 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/suojin_back.svg b/product/phone/src/main/resources/base/media/suojin_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..b0c3bb7d79ca8c3b846afe9ec2a21ca03c9d23cf --- /dev/null +++ b/product/phone/src/main/resources/base/media/suojin_back.svg @@ -0,0 +1 @@ +缩进2 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/take_picture.svg b/product/phone/src/main/resources/base/media/take_picture.svg new file mode 100644 index 0000000000000000000000000000000000000000..48d8ce55d926dfc22e4f8f1e74ddd71924bd9b2d --- /dev/null +++ b/product/phone/src/main/resources/base/media/take_picture.svg @@ -0,0 +1 @@ +拍照-实心 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/tick_thick.svg b/product/phone/src/main/resources/base/media/tick_thick.svg new file mode 100644 index 0000000000000000000000000000000000000000..ca03aeffca1cffce401404f626ca0d9250aec3a3 --- /dev/null +++ b/product/phone/src/main/resources/base/media/tick_thick.svg @@ -0,0 +1 @@ +勾 粗 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/tick_thin.svg b/product/phone/src/main/resources/base/media/tick_thin.svg new file mode 100644 index 0000000000000000000000000000000000000000..cd56ace61d7ea889a07147861e81dc63524e2dfa --- /dev/null +++ b/product/phone/src/main/resources/base/media/tick_thin.svg @@ -0,0 +1 @@ +勾 细 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/todo.svg b/product/phone/src/main/resources/base/media/todo.svg new file mode 100644 index 0000000000000000000000000000000000000000..5eddff14cce3a7575a1c1f7b4da25e45b50100d3 --- /dev/null +++ b/product/phone/src/main/resources/base/media/todo.svg @@ -0,0 +1 @@ +下一步 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/todo1.svg b/product/phone/src/main/resources/base/media/todo1.svg new file mode 100644 index 0000000000000000000000000000000000000000..777829853da50cbf0c1b1bb377dc2ad74164ee3a --- /dev/null +++ b/product/phone/src/main/resources/base/media/todo1.svg @@ -0,0 +1 @@ +todo \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/todo_1.svg b/product/phone/src/main/resources/base/media/todo_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1c784c93a307945135c9a6bf030ba57a1ef1f02 --- /dev/null +++ b/product/phone/src/main/resources/base/media/todo_1.svg @@ -0,0 +1 @@ +todo-实心 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/topped.svg b/product/phone/src/main/resources/base/media/topped.svg new file mode 100644 index 0000000000000000000000000000000000000000..7a9093a76fc4f223857ebbcf52b0632e9840ece5 --- /dev/null +++ b/product/phone/src/main/resources/base/media/topped.svg @@ -0,0 +1,12 @@ + + + + + 置顶-实心 + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/triangle.svg b/product/phone/src/main/resources/base/media/triangle.svg new file mode 100644 index 0000000000000000000000000000000000000000..6bd84c78e21a55703c5625c0d881eb4ffb112c4f --- /dev/null +++ b/product/phone/src/main/resources/base/media/triangle.svg @@ -0,0 +1,11 @@ + + + + +下拉三角 + + diff --git a/product/phone/src/main/resources/base/media/tudo2_1.svg b/product/phone/src/main/resources/base/media/tudo2_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..be9ec5a841a408973a78a3707fd0236dcb576995 --- /dev/null +++ b/product/phone/src/main/resources/base/media/tudo2_1.svg @@ -0,0 +1 @@ +tudo2 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/unChecked.svg b/product/phone/src/main/resources/base/media/unChecked.svg new file mode 100644 index 0000000000000000000000000000000000000000..fada73aaccd4b8e03ee76a7530844ceabff30944 --- /dev/null +++ b/product/phone/src/main/resources/base/media/unChecked.svg @@ -0,0 +1,17 @@ + + + + +选中前 + + + + + diff --git a/product/phone/src/main/resources/base/media/unClassified.svg b/product/phone/src/main/resources/base/media/unClassified.svg new file mode 100644 index 0000000000000000000000000000000000000000..2174ec82278536444d22d8952cf2d096ff694c13 --- /dev/null +++ b/product/phone/src/main/resources/base/media/unClassified.svg @@ -0,0 +1 @@ +笔记本 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/underline.svg b/product/phone/src/main/resources/base/media/underline.svg new file mode 100644 index 0000000000000000000000000000000000000000..85d31b30312a9eb22ff26623c8670a1914795095 --- /dev/null +++ b/product/phone/src/main/resources/base/media/underline.svg @@ -0,0 +1 @@ +下划线 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/undo.svg b/product/phone/src/main/resources/base/media/undo.svg new file mode 100644 index 0000000000000000000000000000000000000000..d322c11ffe776291ed52786058a66295d8f165eb --- /dev/null +++ b/product/phone/src/main/resources/base/media/undo.svg @@ -0,0 +1 @@ +上一步 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/unlock.svg b/product/phone/src/main/resources/base/media/unlock.svg new file mode 100644 index 0000000000000000000000000000000000000000..8b24ba9d6ea27919856297473987fda319273bee --- /dev/null +++ b/product/phone/src/main/resources/base/media/unlock.svg @@ -0,0 +1 @@ +解锁 \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/verticalBar.svg b/product/phone/src/main/resources/base/media/verticalBar.svg new file mode 100644 index 0000000000000000000000000000000000000000..1531d9ed7b5b32d49682e97e22d587e686ad7dd6 --- /dev/null +++ b/product/phone/src/main/resources/base/media/verticalBar.svg @@ -0,0 +1,10 @@ + + + + +画板 + + diff --git a/product/phone/src/main/resources/base/media/zoom.svg b/product/phone/src/main/resources/base/media/zoom.svg new file mode 100644 index 0000000000000000000000000000000000000000..ac8e444aa303ca20471c748e19b7f6f83184b617 --- /dev/null +++ b/product/phone/src/main/resources/base/media/zoom.svg @@ -0,0 +1,15 @@ + + + + +画板 + + + + + + + diff --git a/product/tablet/build.gradle b/product/tablet/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..3f68c190541a39960797727e008d40ec805ea72f --- /dev/null +++ b/product/tablet/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 8 + defaultConfig { + compatibleSdkVersion 8 + } + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { +} diff --git a/product/tablet/src/main/config.json b/product/tablet/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8e41de7b25dad35ddf1ea55818b6865bebb86104 --- /dev/null +++ b/product/tablet/src/main/config.json @@ -0,0 +1,98 @@ +{ + "app": { + "bundleName": "com.ohos.note", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.note", + "name": ".MyApplication", + "mainAbility": "com.ohos.note.MainAbility", + "deviceType": [ + "tablet" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "tablet", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.ohos.note.MainAbility", + "icon": "$media:note", + "description": "$string:description_mainability", + "label":"$string:entry_MainAbility", + "type": "page", + "launchType": "singleton", + "srcPath": "MainAbility", + "srcLanguage": "ets", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme" + } + ] + } + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/MyNoteHome", + "pages/NoteHome" + ], + "name": "MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.READ_MEDIA", + "reason": "This is used to access photos and videos" + }, + { + "name": "ohos.permission.WRITE_MEDIA", + "reason": "This is used to access photos and videos." + }, + { + "name": "ohos.permission.WRITE_EXTERNAL_MEDIA_MEMORY", + "reason": "This is used to access photos and videos." + }, + { + "name": "ohos.permission.MEDIA_LOCATION", + "reason": "This is used to access photos and videos." + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "reques permission" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "reques permission" + } + ] + } +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/AbilityStage.ts b/product/tablet/src/main/ets/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..71e62c4ff167457ad15522c8aa35ca996ab3cc92 --- /dev/null +++ b/product/tablet/src/main/ets/AbilityStage.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/MainAbility.ts b/product/tablet/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c15cc6795afb35c613e960d89c0750dd9a9b0120 --- /dev/null +++ b/product/tablet/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason) + if (launchParam.launchReason == 3) { + // 获取对端的迁移数据 + let continueFolder: string = want.parameters["ContinueFolder"] + let continueNote: string = want.parameters["ContinueNote"] + let continueSection: number = want.parameters["ContinueSection"] + console.log("MainAbility launchReason = 3, continueFolder is " + continueFolder) + console.log("MainAbility launchReason = 3, continueNote is " + continueNote) + console.log("MainAbility launchReason = 3, continueSection is " + continueSection) + // 迁移数据存入AppStorage + AppStorage.SetOrCreate('ContinueFolder', continueFolder) + AppStorage.SetOrCreate('ContinueNote', continueNote) + AppStorage.SetOrCreate('ContinueSection', continueSection) + // 设置迁移标记 + AppStorage.SetOrCreate('IsContinue', 1) + this.context.restoreWindowStage(null); + } + } + + onDestroy() { + console.log("MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + console.log("MainAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/MyNoteHome", null) + } + + onWindowStageDestroy() { + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + console.log("MainAbility onForeground") + } + + onBackground() { + console.log("MainAbility onBackground") + } + + onContinue(wantParam: { [key: string]: any }) { + console.log("MainAbility onContinue") + + // 获取本端的迁移数据 + let continueFolder = AppStorage.Get('ContinueFolder') + if (continueFolder == undefined || continueFolder == null) { + console.log("MainAbility onContinue, continue first folder") + continueFolder = JSON.stringify(AppStorage.Get('AllFolderArray')[0].toFolderObject()) + } + console.log("MainAbility onContinue, continueFolder is " + continueFolder) + + let continueNote = AppStorage.Get('ContinueNote') + if (continueNote == undefined || continueNote == null) { + console.log("MainAbility onContinue, continue first note") + continueNote = JSON.stringify(AppStorage.Get('AllNoteArray')[0].toNoteObject()) + } + console.log("MainAbility onContinue, continueNote is " + continueNote) + + let continueSection = AppStorage.Get('ContinueSection') + if (continueSection == undefined || continueSection == null) { + console.log("MainAbility onContinue, continue section 3") + continueSection = 3 + } + console.log("MainAbility onContinue, continueSection is " + continueSection) + + // 保存本端的迁移数据 + wantParam["ContinueFolder"] = continueFolder; + wantParam["ContinueNote"] = continueNote; + wantParam["ContinueSection"] = continueSection; + + return true + } +}; diff --git a/product/tablet/src/main/ets/MainAbility/app.ets b/product/tablet/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..64e632597a8f872d1192a096c6c6e5da34738861 --- /dev/null +++ b/product/tablet/src/main/ets/MainAbility/app.ets @@ -0,0 +1,17 @@ +import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' + +const TAG = "NoteApp" + +export default { + onCreate() { + LogUtil.info(TAG, "Application onCreate") + AppStorage.SetOrCreate('AllFolderArray', []) + AppStorage.SetOrCreate('AllNoteArray', []) + AppStorage.SetOrCreate('DBQueryFinished', 0) + LogUtil.info(TAG, "AppStorage SetOrCreate : AllFolderArray, AllNoteArray, DBQueryFinished") + }, + + onDestroy() { + LogUtil.info(TAG, 'Application onDestroy') + }, +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..541557acc1e7b14c10fcdd08bd7f8fe4456e1a75 --- /dev/null +++ b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fileio from '@ohos.fileio' +import {NoteHomeComp} from './NoteHome.ets' +import {NoteHomePortraitComp} from './NoteHomePortrait.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' + +@Entry +@Component +export struct MyNoteHomeComp { + @StorageLink('DBQueryFinished') dBQueryFinished: number = 0 + @Provide('PortraitModel') portraitModel: boolean = false + private context = getContext(this) + TAG = "MyNoteHomeComp" + + build() { + Flex() { + if (this.dBQueryFinished == 1) { + if (this.portraitModel == true) { + NoteHomePortraitComp() + } else { + NoteHomeComp() + } + } + } + .width('100%').height('100%') + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + + if (this.context == undefined || this.context == null) { + LogUtil.error(this.TAG, "context is error") + return + } + + LogUtil.info(this.TAG, "databaseDir is " + this.context.databaseDir) + // /data/storage/el2/database/tablet + + let dbPath = "/data/app/el2/100/database/com.ohos.note/tablet/db/note.db" + try { + if (fileio.accessSync(dbPath) == undefined) { + LogUtil.info(this.TAG, "db has created") + RdbStoreUtil.initAppStorage(this.context) + } + } catch (err) { + LogUtil.info(this.TAG, "db has not created, start to create db") + RdbStoreUtil.createRdbStore(this.context) + } + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0b02208aca15b214b6ad1792379726cf3c240d4 --- /dev/null +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' +import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' +import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' +import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' +import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {SysDefFolderUuid} from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import LayoutUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets' +import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' + +@Entry +@Component +export struct NoteHomeComp { + @Provide('RefreshFlag') refreshFlag: number = 0 + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + + // 当前文件夹、笔记、分栏 + @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') + @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section'); + + @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; + @Provide('LastSectionStatus') lastSectionStatus: number = 3; // 记录分栏上一次的状态 + @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 + @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 + @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 + @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 + @Provide('SelectedAll') selectedAll: boolean = false; + @Provide('EditModel') editModel: boolean = false //编辑模式:临时方案 + private controllerShow: WebController = new WebController() //第三栏展示 + + TAG = "NoteHomeComp" + + build() { + Flex({ justifyContent: FlexAlign.Start }) { + // Folder list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { + FolderListComp({controllerShow: this.controllerShow}) + } + .flexShrink(0) + .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).folderListWeight) + .height(StyleConstants.PERCENTAGE_100) + .visibility( + LayoutUtil.getWidthWeightMessage(this.sectionStatus) + .folderListVisibility == 0 ? Visibility.None : Visibility.Visible) + .opacity(this.search ? StyleConstants.OPACITY_40 : StyleConstants.OPACITY_100) + .enabled(this.search ? false : true) + + Divider() + .vertical(true) + .strokeWidth(1) + .color($r("app.color.divider_color_182431")) + .height("100%") + .opacity(StyleConstants.OPACITY_10) + // Note list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteListComp({controllerShow: this.controllerShow}) + } + .flexShrink(0) + .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteListWeight) + .height(StyleConstants.PERCENTAGE_100) + .visibility( + LayoutUtil.getWidthWeightMessage(this.sectionStatus) + .noteListVisibility == 0 ? Visibility.None : Visibility.Visible); + Divider() + .vertical(true) + .strokeWidth(1) + .color($r("app.color.divider_color_182431")) + .height("100%") + .opacity(StyleConstants.OPACITY_10) + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContentComp({controllerShow: this.controllerShow}) + } + .flexShrink(0) + .backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notecontent_color_ffffff")) + .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight) + .height(StyleConstants.PERCENTAGE_100) + .opacity(this.longpress ? StyleConstants.OPACITY_40 : this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_20 : StyleConstants.OPACITY_100) + .enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true) + } + .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets new file mode 100644 index 0000000000000000000000000000000000000000..31fc6c1ed9d1749b66b45f3adff425b1aeb56382 --- /dev/null +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' +import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' +import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' +import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' +import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' + +@Entry +@Component +export struct NoteHomePortraitComp { + @Provide('RefreshFlag') refreshFlag: number = 0 + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + + // 当前文件夹、笔记、分栏 + @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') + @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section'); + + @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; + @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 + @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 + @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 + @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 + + TAG = "NoteHomeComp" + + build() { + Stack({ alignContent: Alignment.Start }) { + + // Note list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteListComp() + } + .width(StyleConstants.PERCENTAGE_100) + .height(StyleConstants.PERCENTAGE_100) + .enabled(this.expandStatus ? false : true) + + //Folder list display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { + FolderListComp() + } + .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) + .width(StyleConstants.PERCENTAGE_60) + .height(StyleConstants.PERCENTAGE_100) + .visibility(this.expandStatus == false ? Visibility.None:Visibility.Visible) + + + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContentComp() + } + .backgroundColor($r("app.color.notecontent_color_ffffff")) + .width(StyleConstants.PERCENTAGE_100) + .height(StyleConstants.PERCENTAGE_100) + .visibility(this.chooseNote == false ? Visibility.None:Visibility.Visible) + } + .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) + } + + aboutToAppear(): void{ + LogUtil.info(this.TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(this.TAG, "aboutToDisappear") + } +} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/res/cake.png b/product/tablet/src/main/ets/MainAbility/res/cake.png new file mode 100644 index 0000000000000000000000000000000000000000..e56343fb562b5c1e5470707abfe4e65979939418 Binary files /dev/null and b/product/tablet/src/main/ets/MainAbility/res/cake.png differ diff --git a/product/tablet/src/main/ets/MainAbility/res/lvyou.png b/product/tablet/src/main/ets/MainAbility/res/lvyou.png new file mode 100644 index 0000000000000000000000000000000000000000..5a4c05f0a9afbf6479b50155db28aaf49ba36e2e Binary files /dev/null and b/product/tablet/src/main/ets/MainAbility/res/lvyou.png differ diff --git a/product/tablet/src/main/ets/MainAbility/res/shuxue.png b/product/tablet/src/main/ets/MainAbility/res/shuxue.png new file mode 100644 index 0000000000000000000000000000000000000000..8af342a8d6b761f78c9e28f8a3bf1d84ead54ba4 Binary files /dev/null and b/product/tablet/src/main/ets/MainAbility/res/shuxue.png differ diff --git a/product/tablet/src/main/resources/base/element/color.json b/product/tablet/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..69a86f115b5f4e3746b6dc8b506c02937c823e12 --- /dev/null +++ b/product/tablet/src/main/resources/base/element/color.json @@ -0,0 +1,92 @@ +{ + "color": [ + { + "name": "color_ffffff", + "value": "#ffffff" + }, + { + "name": "color_fffffB", + "value": "#FFFBFBFB" + }, + { + "name": "delete_color_fa2a2d", + "value": "#fa2a2d" + }, + { + "name": "cancel_color_4fb4e3", + "value": "#4fb4e3" + }, + { + "name": "divider_color_e4e4e4", + "value": "#cce4e4e4" + }, + { + "name": "divider_color_182431", + "value": "#182431" + }, + { + "name": "button_color_419fff", + "value": "#419fff" + }, + { + "name": "button_color_fb4447", + "value": "#fb4447" + }, + { + "name": "text_color_3f97e9", + "value": "#3f97e9" + }, + { + "name": "text_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_182431", + "value": "#182431" + }, + { + "name": "folder_color_f86d05", + "value": "#f86d05" + }, + { + "name": "folder_color_ffffff", + "value": "#ffffff" + }, + { + "name": "folder_color_19ffffff", + "value": "#19ffffff" + }, + { + "name": "folder_color_19182431", + "value": "#19182431" + }, + { + "name": "notecontent_color_ffffff", + "value": "#ffffff" + }, + { + "name": "notecontent_color_000000", + "value": "#000000" + }, + { + "name": "folderlist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_f1f3f5", + "value": "#f1f3f5" + }, + { + "name": "notelist_bgcolor_000000", + "value": "#000000" + }, + { + "name": "image_bordercolor_19182431", + "value": "#19182431" + }, + { + "name": "button_color_f86d05", + "value": "#f86d05" + } + ] +} \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/element/float.json b/product/tablet/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..fe803f0649fe2816669468a39f02622d8215da85 --- /dev/null +++ b/product/tablet/src/main/resources/base/element/float.json @@ -0,0 +1,136 @@ +{ + "float": [ + { + "name": "wh_value_1", + "value": "1" + }, + { + "name": "wh_value_4", + "value": "4" + }, + { + "name": "wh_value_5", + "value": "5" + }, + { + "name": "wh_value_8", + "value": "8" + }, + { + "name": "wh_value_10", + "value": "10" + }, + { + "name": "wh_value_14", + "value": "14" + }, + { + "name": "wh_value_16", + "value": "16" + }, + { + "name": "wh_value_20", + "value": "20" + }, + { + "name": "wh_value_24", + "value": "24" + }, + { + "name": "wh_value_30", + "value": "30" + }, + { + "name": "wh_value_40", + "value": "40" + }, + { + "name": "wh_value_50", + "value": "50" + }, + { + "name": "wh_value_60", + "value": "60" + }, + { + "name": "wh_value_65", + "value": "65" + }, + { + "name": "wh_value_70", + "value": "70" + }, + { + "name": "wh_value_80", + "value": "80" + }, + { + "name": "wh_value_100", + "value": "100" + }, + { + "name": "wh_value_120", + "value": "120" + }, + { + "name": "wh_value_130", + "value": "1300" + }, + { + "name": "wh_value_160", + "value": "160" + }, + { + "name": "wh_value_230", + "value": "230" + }, + { + "name": "wh_value_280", + "value": "280" + }, + { + "name": "wh_value_390", + "value": "390" + }, + { + "name": "wh_value_400", + "value": "400" + }, + { + "name": "font_35", + "value": "35" + }, + { + "name": "font_15", + "value": "15" + }, + { + "name": "font_20", + "value": "20" + }, + { + "name": "font_25", + "value": "25" + }, + { + "name": "font_28", + "value": "28" + }, + { + "name": "font_50", + "value": "50" + }, + { + "name": "control_common_font_size", + "value": "20" + }, + { + "name": "slider_text_padding_left", + "value": "5" + }, + { + "name": "volume_border_radius", + "value": "15" + } + ] +} \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/element/string.json b/product/tablet/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..db8ce11e572309263e645787c051e29aeb95981f --- /dev/null +++ b/product/tablet/src/main/resources/base/element/string.json @@ -0,0 +1,144 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "备忘录" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "note", + "value": "笔记" + }, + { + "name": "allNotes", + "value": "全部笔记" + }, + { + "name": "unClassified", + "value": "未分类" + }, + { + "name": "recentDeletes", + "value": "最近删除" + }, + { + "name": "myFavorites", + "value": "我的收藏" + }, + { + "name": "create", + "value": "新建" + }, + { + "name": "createFolder", + "value": "新建文件夹" + }, + { + "name": "editFolder", + "value": "编辑文件夹" + }, + { + "name": "deleteFolder", + "value": "删除文件夹" + }, + { + "name": "createNote", + "value": "新建笔记" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "save", + "value": "保存" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "name", + "value": "名称" + }, + { + "name": "delete_tips", + "value": "是否删除此文件夹及其中的内容?" + }, + { + "name": "deleteNote", + "value": "是否删除此笔记?" + }, + { + "name": "deleteNoteComplete", + "value": "此笔记将被永久删除,无法恢复。是否删除?" + }, + { + "name": "deleteAllNote", + "value": "是否删除全部笔记?" + }, + { + "name": "deletePartNote", + "value": "是否删除%d条笔记?" + }, + { + "name": "selected", + "value": "已选择%d项" + }, + { + "name": "none_selected", + "value": "未选择" + }, + { + "name": "noteslist", + "value": "条笔记" + }, + { + "name": "Empty_page", + "value": "没有笔记" + }, + { + "name": "searchNote", + "value": "搜索笔记" + }, + { + "name": "chooseFolder", + "value": "请选择文件夹" + }, + { + "name": "category_already_exist", + "value": "文件夹名称已存在" + }, + { + "name": "input_placeholder", + "value": "名称" + }, + { + "name": "permanently_delete_tips", + "value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除" + }, + { + "name": "set_top", + "value": "置顶" + }, + { + "name": "move", + "value": "移到" + }, + { + "name": "recover", + "value": "恢复" + }, + { + "name": "check_all", + "value": "多选" + }, + { + "name": "editNoteTitle", + "value": "修改标题" + } + ] +} \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/action_bold.svg b/product/tablet/src/main/resources/base/media/action_bold.svg new file mode 100644 index 0000000000000000000000000000000000000000..5dd179bf754ea76483fe060fe557c5f90555b007 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/action_bold.svg @@ -0,0 +1 @@ +文本粗细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/addNote.svg b/product/tablet/src/main/resources/base/media/addNote.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cbab4ecaf96539318d40d08f89a20d53b83fd68 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/addNote.svg @@ -0,0 +1 @@ +加-细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/allNotes.svg b/product/tablet/src/main/resources/base/media/allNotes.svg new file mode 100644 index 0000000000000000000000000000000000000000..0bd2d8c13393463d11359016cbe466a58eebebb1 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/allNotes.svg @@ -0,0 +1 @@ +笔记 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/back.svg b/product/tablet/src/main/resources/base/media/back.svg new file mode 100644 index 0000000000000000000000000000000000000000..95e1f5dcafef66bc67faefd4f4236d967fb2bf1e --- /dev/null +++ b/product/tablet/src/main/resources/base/media/back.svg @@ -0,0 +1 @@ +back \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/back_1.svg b/product/tablet/src/main/resources/base/media/back_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..95e1f5dcafef66bc67faefd4f4236d967fb2bf1e --- /dev/null +++ b/product/tablet/src/main/resources/base/media/back_1.svg @@ -0,0 +1 @@ +back \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/camera.svg b/product/tablet/src/main/resources/base/media/camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..cd8fa1b37fe8d7a9101420824508ca3f799cc73d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/camera.svg @@ -0,0 +1 @@ +相机 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/check_all.svg b/product/tablet/src/main/resources/base/media/check_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..64922fddec736eb05e633d31ea2e66084e810941 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/check_all.svg @@ -0,0 +1 @@ +全选 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/check_all1.svg b/product/tablet/src/main/resources/base/media/check_all1.svg new file mode 100644 index 0000000000000000000000000000000000000000..34d884faffc40e149704c6fb009ebacb64a4f34e --- /dev/null +++ b/product/tablet/src/main/resources/base/media/check_all1.svg @@ -0,0 +1,13 @@ + + + + + 全选 + + \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/checked.svg b/product/tablet/src/main/resources/base/media/checked.svg new file mode 100644 index 0000000000000000000000000000000000000000..32708c95c6538825b3270d4684ca3c19942af6d2 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/checked.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + +选中后 + + + + + + + + + + + diff --git a/product/tablet/src/main/resources/base/media/choose_all.svg b/product/tablet/src/main/resources/base/media/choose_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..64922fddec736eb05e633d31ea2e66084e810941 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/choose_all.svg @@ -0,0 +1 @@ +全选 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/circle_tick.svg b/product/tablet/src/main/resources/base/media/circle_tick.svg new file mode 100644 index 0000000000000000000000000000000000000000..10eba81489c855357a5a9188ce84923b2dd8d630 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/circle_tick.svg @@ -0,0 +1 @@ +文本扫描 对勾 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/circle_tick1.svg b/product/tablet/src/main/resources/base/media/circle_tick1.svg new file mode 100644 index 0000000000000000000000000000000000000000..295c58cfd197dbb0042035563e8970ba60268b3c --- /dev/null +++ b/product/tablet/src/main/resources/base/media/circle_tick1.svg @@ -0,0 +1 @@ +文档扫描 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/cross.svg b/product/tablet/src/main/resources/base/media/cross.svg new file mode 100644 index 0000000000000000000000000000000000000000..c4a4e0fa6db0fc09a6183dcd28944bc14544ff51 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/cross.svg @@ -0,0 +1 @@ +叉-粗 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/cross_thick.svg b/product/tablet/src/main/resources/base/media/cross_thick.svg new file mode 100644 index 0000000000000000000000000000000000000000..c4a4e0fa6db0fc09a6183dcd28944bc14544ff51 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/cross_thick.svg @@ -0,0 +1 @@ +叉-粗 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/cross_thin.svg b/product/tablet/src/main/resources/base/media/cross_thin.svg new file mode 100644 index 0000000000000000000000000000000000000000..6373a780e0205927ce0676b25603b1ac3f3da0bf --- /dev/null +++ b/product/tablet/src/main/resources/base/media/cross_thin.svg @@ -0,0 +1 @@ +叉-细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/cycle_thin1.svg b/product/tablet/src/main/resources/base/media/cycle_thin1.svg new file mode 100644 index 0000000000000000000000000000000000000000..1fc2cba67ff00b50e6e8975c2ce355fe9925f513 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/cycle_thin1.svg @@ -0,0 +1 @@ +cycle-细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/delete.svg b/product/tablet/src/main/resources/base/media/delete.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f1c1fb0fe0a5f265cb70d4a5f5163c9360b934d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/delete.svg @@ -0,0 +1 @@ +删除 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/delete1.svg b/product/tablet/src/main/resources/base/media/delete1.svg new file mode 100644 index 0000000000000000000000000000000000000000..c97adea0c568fbf9033a511049456f04c43d8e38 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/delete1.svg @@ -0,0 +1 @@ +删除-实心 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/delete2.svg b/product/tablet/src/main/resources/base/media/delete2.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f1c1fb0fe0a5f265cb70d4a5f5163c9360b934d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/delete2.svg @@ -0,0 +1 @@ +删除 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/emptyPage.svg b/product/tablet/src/main/resources/base/media/emptyPage.svg new file mode 100644 index 0000000000000000000000000000000000000000..a0e85ddd28ab287cbdb667dff4a9be0604322c35 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/emptyPage.svg @@ -0,0 +1,47 @@ + + + + +笔记空页面 + + + + + + + + + + + + + diff --git a/product/tablet/src/main/resources/base/media/favorite.svg b/product/tablet/src/main/resources/base/media/favorite.svg new file mode 100644 index 0000000000000000000000000000000000000000..b3d1e16d6c382e8bdaff495a17c78b28b6e2b8ea --- /dev/null +++ b/product/tablet/src/main/resources/base/media/favorite.svg @@ -0,0 +1 @@ +收藏-实心 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/favorite_cancel.svg b/product/tablet/src/main/resources/base/media/favorite_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..c7d09d60a002714a157efe03f0e12d36bff2e50d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/favorite_cancel.svg @@ -0,0 +1,30 @@ + + + + +收藏(线性) + + diff --git a/product/tablet/src/main/resources/base/media/foldMove_select.svg b/product/tablet/src/main/resources/base/media/foldMove_select.svg new file mode 100644 index 0000000000000000000000000000000000000000..6b7b9d104f70c7c42cf1b55968c2741c7bb8d2b6 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/foldMove_select.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + +选中 + + + + + + + + + + + diff --git a/product/tablet/src/main/resources/base/media/foldMove_unselect.svg b/product/tablet/src/main/resources/base/media/foldMove_unselect.svg new file mode 100644 index 0000000000000000000000000000000000000000..3b9a209f812946604093d6727483a391cb1243ed --- /dev/null +++ b/product/tablet/src/main/resources/base/media/foldMove_unselect.svg @@ -0,0 +1,18 @@ + + + + +未选中 + + + + + + + diff --git a/product/tablet/src/main/resources/base/media/folder.svg b/product/tablet/src/main/resources/base/media/folder.svg new file mode 100644 index 0000000000000000000000000000000000000000..f5c0bc08ff85e314c7806dc78f72407131314c63 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/folder.svg @@ -0,0 +1 @@ +文件夹 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/font_color.svg b/product/tablet/src/main/resources/base/media/font_color.svg new file mode 100644 index 0000000000000000000000000000000000000000..70ee9eddca2cb58df50a7742e52266781991eda4 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/font_color.svg @@ -0,0 +1 @@ +文本颜色 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/font_large.svg b/product/tablet/src/main/resources/base/media/font_large.svg new file mode 100644 index 0000000000000000000000000000000000000000..82436a95668ffef786c2ba83cbcdeca7d42bf379 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/font_large.svg @@ -0,0 +1,10 @@ + + + + +字体大小备份 2 + + diff --git a/product/tablet/src/main/resources/base/media/font_size.svg b/product/tablet/src/main/resources/base/media/font_size.svg new file mode 100644 index 0000000000000000000000000000000000000000..90b068c2b1d6e14a3921fc9e544fc9b6d3c1cd3a --- /dev/null +++ b/product/tablet/src/main/resources/base/media/font_size.svg @@ -0,0 +1,15 @@ + + + + +字体大小 + + diff --git a/product/tablet/src/main/resources/base/media/font_small.svg b/product/tablet/src/main/resources/base/media/font_small.svg new file mode 100644 index 0000000000000000000000000000000000000000..1a77926bea52bc1c2df79ab49ed4d6f6619968a5 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/font_small.svg @@ -0,0 +1,10 @@ + + + + +字体大小备份 + + diff --git a/product/tablet/src/main/resources/base/media/font_style.svg b/product/tablet/src/main/resources/base/media/font_style.svg new file mode 100644 index 0000000000000000000000000000000000000000..1b57f3f4f17636a8edecf12110fd521437b8ff19 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/font_style.svg @@ -0,0 +1 @@ +文本样式 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/format_italic.svg b/product/tablet/src/main/resources/base/media/format_italic.svg new file mode 100644 index 0000000000000000000000000000000000000000..7695394d1b41e9584ac56aa63a84b62d4d7baa6f --- /dev/null +++ b/product/tablet/src/main/resources/base/media/format_italic.svg @@ -0,0 +1 @@ +文本倾斜 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/format_menubullte1.svg b/product/tablet/src/main/resources/base/media/format_menubullte1.svg new file mode 100644 index 0000000000000000000000000000000000000000..26b7cc4b005dacef2d268e5d8d3c838b4754001b --- /dev/null +++ b/product/tablet/src/main/resources/base/media/format_menubullte1.svg @@ -0,0 +1 @@ +符号标注2 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/format_menubullte2.svg b/product/tablet/src/main/resources/base/media/format_menubullte2.svg new file mode 100644 index 0000000000000000000000000000000000000000..ebf9a2af47457da77e99256e7005ef808514f87d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/format_menubullte2.svg @@ -0,0 +1 @@ +符号标注3 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/format_menulist_alphabet.svg b/product/tablet/src/main/resources/base/media/format_menulist_alphabet.svg new file mode 100644 index 0000000000000000000000000000000000000000..efc97ae0786bd98c7d0c91d975d1f52791ed3c5c --- /dev/null +++ b/product/tablet/src/main/resources/base/media/format_menulist_alphabet.svg @@ -0,0 +1 @@ +英文符号 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/format_menulist_number.svg b/product/tablet/src/main/resources/base/media/format_menulist_number.svg new file mode 100644 index 0000000000000000000000000000000000000000..6e778c04311ba5712e24f99260bc6635af620115 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/format_menulist_number.svg @@ -0,0 +1 @@ +数字符号 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/huaweishare1.svg b/product/tablet/src/main/resources/base/media/huaweishare1.svg new file mode 100644 index 0000000000000000000000000000000000000000..a5879634a21ef9f48552f2fae3bebeca20774ede --- /dev/null +++ b/product/tablet/src/main/resources/base/media/huaweishare1.svg @@ -0,0 +1 @@ +huaweishare \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/icon.png b/product/tablet/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/product/tablet/src/main/resources/base/media/icon.png differ diff --git a/product/tablet/src/main/resources/base/media/left_justify.svg b/product/tablet/src/main/resources/base/media/left_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..93e982c063728669cba5f2294a4fde439cb6a894 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/left_justify.svg @@ -0,0 +1 @@ +左对齐 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/location_notify.svg b/product/tablet/src/main/resources/base/media/location_notify.svg new file mode 100644 index 0000000000000000000000000000000000000000..44a24c02e2ad637aa4cd70152ee80a8944ae80e2 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/location_notify.svg @@ -0,0 +1 @@ +位置提醒 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/mid_justify.svg b/product/tablet/src/main/resources/base/media/mid_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..499b42cc4ee9cadb7dd5614c9eea6048da8ac001 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/mid_justify.svg @@ -0,0 +1 @@ +居中 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/minus.svg b/product/tablet/src/main/resources/base/media/minus.svg new file mode 100644 index 0000000000000000000000000000000000000000..fd73046a41f74fb199dd204695333487fb74b00d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/more_1.svg b/product/tablet/src/main/resources/base/media/more_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..76b19e9a6cf6b6f369d96e233804bcf8a863b824 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/more_1.svg @@ -0,0 +1 @@ +more \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/more_list1.svg b/product/tablet/src/main/resources/base/media/more_list1.svg new file mode 100644 index 0000000000000000000000000000000000000000..beaecc56efd1efef11052740cd383fdd96be8e8d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/more_list1.svg @@ -0,0 +1 @@ +more-list \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/move.svg b/product/tablet/src/main/resources/base/media/move.svg new file mode 100644 index 0000000000000000000000000000000000000000..510e493857cf016df3ac988cf3e81e6a22ac6a9c --- /dev/null +++ b/product/tablet/src/main/resources/base/media/move.svg @@ -0,0 +1 @@ +移动 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/multi_choose.svg b/product/tablet/src/main/resources/base/media/multi_choose.svg new file mode 100644 index 0000000000000000000000000000000000000000..5a6c7582eca673c066ebe267ec8ff7743cef8335 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/multi_choose.svg @@ -0,0 +1 @@ +多选 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/note.png b/product/tablet/src/main/resources/base/media/note.png new file mode 100644 index 0000000000000000000000000000000000000000..fd48594285247f23b6d4b50400064f34d39c8a5e Binary files /dev/null and b/product/tablet/src/main/resources/base/media/note.png differ diff --git a/product/tablet/src/main/resources/base/media/pic_choose.svg b/product/tablet/src/main/resources/base/media/pic_choose.svg new file mode 100644 index 0000000000000000000000000000000000000000..ceb230fc0da6be2f7f3c0e6f56b6474efbf88145 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/pic_choose.svg @@ -0,0 +1 @@ +复制图片 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/picture_dark.svg b/product/tablet/src/main/resources/base/media/picture_dark.svg new file mode 100644 index 0000000000000000000000000000000000000000..3f97504693b872a97c15e073dbed9cedd4fe824b --- /dev/null +++ b/product/tablet/src/main/resources/base/media/picture_dark.svg @@ -0,0 +1 @@ +图片-实心 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/picture_white.svg b/product/tablet/src/main/resources/base/media/picture_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..1def639bcda5ff67fcfbf296417597dc88a2455f --- /dev/null +++ b/product/tablet/src/main/resources/base/media/picture_white.svg @@ -0,0 +1 @@ +图片 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/recover.svg b/product/tablet/src/main/resources/base/media/recover.svg new file mode 100644 index 0000000000000000000000000000000000000000..c0ce26aa75c3bf57305c2253bcd43e87afa407d7 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/recover.svg @@ -0,0 +1,14 @@ + + + + +恢复 + + diff --git a/product/tablet/src/main/resources/base/media/refresh.svg b/product/tablet/src/main/resources/base/media/refresh.svg new file mode 100644 index 0000000000000000000000000000000000000000..13823368c3237daf74c3ae1cfe00e39da86bd383 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/refresh.svg @@ -0,0 +1 @@ +刷新 细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/right_justify.svg b/product/tablet/src/main/resources/base/media/right_justify.svg new file mode 100644 index 0000000000000000000000000000000000000000..e43328281277316793c51ec94faf9aeb9e702791 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/right_justify.svg @@ -0,0 +1 @@ +右对齐 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/save.svg b/product/tablet/src/main/resources/base/media/save.svg new file mode 100644 index 0000000000000000000000000000000000000000..78d5245d0c330a3710bdec6ae4be026b454e1508 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/save.svg @@ -0,0 +1 @@ +储存 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/search.svg b/product/tablet/src/main/resources/base/media/search.svg new file mode 100644 index 0000000000000000000000000000000000000000..2dae1c554b597d9f0a67197fa44330c072dfd606 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/search.svg @@ -0,0 +1,13 @@ + + + + +搜索 + + diff --git a/product/tablet/src/main/resources/base/media/search_note.svg b/product/tablet/src/main/resources/base/media/search_note.svg new file mode 100644 index 0000000000000000000000000000000000000000..550d83197b1594240db1609fd62749e60c5e8f64 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/search_note.svg @@ -0,0 +1 @@ +搜索 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/set_top.svg b/product/tablet/src/main/resources/base/media/set_top.svg new file mode 100644 index 0000000000000000000000000000000000000000..f79d2d7076ed275b3efe5cae46817808d41882c0 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/set_top.svg @@ -0,0 +1 @@ +置顶 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/share.svg b/product/tablet/src/main/resources/base/media/share.svg new file mode 100644 index 0000000000000000000000000000000000000000..e767312fa8241aa3bb36b5436f6c72be95a96956 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/share.svg @@ -0,0 +1 @@ +分享 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/styles.svg b/product/tablet/src/main/resources/base/media/styles.svg new file mode 100644 index 0000000000000000000000000000000000000000..4fb5bb6b99656b56ce68627725d165454ba477bc --- /dev/null +++ b/product/tablet/src/main/resources/base/media/styles.svg @@ -0,0 +1,11 @@ + + + +样式 + + diff --git a/product/tablet/src/main/resources/base/media/suojin.svg b/product/tablet/src/main/resources/base/media/suojin.svg new file mode 100644 index 0000000000000000000000000000000000000000..6dca6e103a6de3216b34f20dc9f4453f5bd2d3e6 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/suojin.svg @@ -0,0 +1 @@ +缩进 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/suojin_back.svg b/product/tablet/src/main/resources/base/media/suojin_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..b0c3bb7d79ca8c3b846afe9ec2a21ca03c9d23cf --- /dev/null +++ b/product/tablet/src/main/resources/base/media/suojin_back.svg @@ -0,0 +1 @@ +缩进2 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/take_picture.svg b/product/tablet/src/main/resources/base/media/take_picture.svg new file mode 100644 index 0000000000000000000000000000000000000000..48d8ce55d926dfc22e4f8f1e74ddd71924bd9b2d --- /dev/null +++ b/product/tablet/src/main/resources/base/media/take_picture.svg @@ -0,0 +1 @@ +拍照-实心 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/tick_thick.svg b/product/tablet/src/main/resources/base/media/tick_thick.svg new file mode 100644 index 0000000000000000000000000000000000000000..ca03aeffca1cffce401404f626ca0d9250aec3a3 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/tick_thick.svg @@ -0,0 +1 @@ +勾 粗 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/tick_thin.svg b/product/tablet/src/main/resources/base/media/tick_thin.svg new file mode 100644 index 0000000000000000000000000000000000000000..cd56ace61d7ea889a07147861e81dc63524e2dfa --- /dev/null +++ b/product/tablet/src/main/resources/base/media/tick_thin.svg @@ -0,0 +1 @@ +勾 细 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/todo.svg b/product/tablet/src/main/resources/base/media/todo.svg new file mode 100644 index 0000000000000000000000000000000000000000..5eddff14cce3a7575a1c1f7b4da25e45b50100d3 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/todo.svg @@ -0,0 +1 @@ +下一步 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/todo1.svg b/product/tablet/src/main/resources/base/media/todo1.svg new file mode 100644 index 0000000000000000000000000000000000000000..777829853da50cbf0c1b1bb377dc2ad74164ee3a --- /dev/null +++ b/product/tablet/src/main/resources/base/media/todo1.svg @@ -0,0 +1 @@ +todo \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/todo_1.svg b/product/tablet/src/main/resources/base/media/todo_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1c784c93a307945135c9a6bf030ba57a1ef1f02 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/todo_1.svg @@ -0,0 +1 @@ +todo-实心 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/topped.svg b/product/tablet/src/main/resources/base/media/topped.svg new file mode 100644 index 0000000000000000000000000000000000000000..7a9093a76fc4f223857ebbcf52b0632e9840ece5 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/topped.svg @@ -0,0 +1,12 @@ + + + + + 置顶-实心 + + \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/triangle.svg b/product/tablet/src/main/resources/base/media/triangle.svg new file mode 100644 index 0000000000000000000000000000000000000000..6bd84c78e21a55703c5625c0d881eb4ffb112c4f --- /dev/null +++ b/product/tablet/src/main/resources/base/media/triangle.svg @@ -0,0 +1,11 @@ + + + + +下拉三角 + + diff --git a/product/tablet/src/main/resources/base/media/tudo2_1.svg b/product/tablet/src/main/resources/base/media/tudo2_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..be9ec5a841a408973a78a3707fd0236dcb576995 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/tudo2_1.svg @@ -0,0 +1 @@ +tudo2 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/unChecked.svg b/product/tablet/src/main/resources/base/media/unChecked.svg new file mode 100644 index 0000000000000000000000000000000000000000..fada73aaccd4b8e03ee76a7530844ceabff30944 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/unChecked.svg @@ -0,0 +1,17 @@ + + + + +选中前 + + + + + diff --git a/product/tablet/src/main/resources/base/media/unClassified.svg b/product/tablet/src/main/resources/base/media/unClassified.svg new file mode 100644 index 0000000000000000000000000000000000000000..2174ec82278536444d22d8952cf2d096ff694c13 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/unClassified.svg @@ -0,0 +1 @@ +笔记本 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/underline.svg b/product/tablet/src/main/resources/base/media/underline.svg new file mode 100644 index 0000000000000000000000000000000000000000..85d31b30312a9eb22ff26623c8670a1914795095 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/underline.svg @@ -0,0 +1 @@ +下划线 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/undo.svg b/product/tablet/src/main/resources/base/media/undo.svg new file mode 100644 index 0000000000000000000000000000000000000000..d322c11ffe776291ed52786058a66295d8f165eb --- /dev/null +++ b/product/tablet/src/main/resources/base/media/undo.svg @@ -0,0 +1 @@ +上一步 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/unlock.svg b/product/tablet/src/main/resources/base/media/unlock.svg new file mode 100644 index 0000000000000000000000000000000000000000..8b24ba9d6ea27919856297473987fda319273bee --- /dev/null +++ b/product/tablet/src/main/resources/base/media/unlock.svg @@ -0,0 +1 @@ +解锁 \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/media/verticalBar.svg b/product/tablet/src/main/resources/base/media/verticalBar.svg new file mode 100644 index 0000000000000000000000000000000000000000..1531d9ed7b5b32d49682e97e22d587e686ad7dd6 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/verticalBar.svg @@ -0,0 +1,10 @@ + + + + +画板 + + diff --git a/product/tablet/src/main/resources/base/media/zoom.svg b/product/tablet/src/main/resources/base/media/zoom.svg new file mode 100644 index 0000000000000000000000000000000000000000..ac8e444aa303ca20471c748e19b7f6f83184b617 --- /dev/null +++ b/product/tablet/src/main/resources/base/media/zoom.svg @@ -0,0 +1,15 @@ + + + + +画板 + + + + + + + diff --git a/product/tablet/src/main/resources/rawfile/baidu.png b/product/tablet/src/main/resources/rawfile/baidu.png new file mode 100644 index 0000000000000000000000000000000000000000..510f111989ba7eb2f9ee158a3d60e3e6d9992347 Binary files /dev/null and b/product/tablet/src/main/resources/rawfile/baidu.png differ diff --git a/product/tablet/src/main/resources/rawfile/cake.png b/product/tablet/src/main/resources/rawfile/cake.png new file mode 100644 index 0000000000000000000000000000000000000000..e56343fb562b5c1e5470707abfe4e65979939418 Binary files /dev/null and b/product/tablet/src/main/resources/rawfile/cake.png differ diff --git a/product/tablet/src/main/resources/rawfile/checkbox.css b/product/tablet/src/main/resources/rawfile/checkbox.css new file mode 100644 index 0000000000000000000000000000000000000000..08d7cd9931bdeb2c5b2f7911e6863debc0e95ae6 --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/checkbox.css @@ -0,0 +1,39 @@ +.note-checkbox:checked { + background: #F88805; + border: 2px solid #F88805; + outline: none; + margin-left:0px; + margin-right:0px; + opacity: 1; +} + +.note-checkbox { + width: 23px; + height: 23px; + background-color: #ffffff; + border: 2px solid #555555; + -webkit-border-radius: 50%; + border-radius: 50%; + font-size: 0.8rem; + margin-left:0px; + margin-top:10px; + margin-right:0px; + margin-bottom:0px; + outline: none; + padding: 0; + position: relative; + display: inline-block; + vertical-align: top; + cursor: default; + -webkit-appearance: none; + -webkit-user-select: none; + user-select: none; + -webkit-transition: background-color ease 0.1s; + transition: background-color ease 0.1s; +} + +.note-checkbox:checked+span{ + text-decoration: line-through; + color:#F88805; + opacity: 0.4; +} \ No newline at end of file diff --git a/product/tablet/src/main/resources/rawfile/editor.html b/product/tablet/src/main/resources/rawfile/editor.html new file mode 100644 index 0000000000000000000000000000000000000000..5acdf2c93302d04f91153812d34056afac673706 --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/editor.html @@ -0,0 +1,18 @@ + + + + + + + + + + + +
+   +
+ + + + diff --git a/product/tablet/src/main/resources/rawfile/lvyou.png b/product/tablet/src/main/resources/rawfile/lvyou.png new file mode 100644 index 0000000000000000000000000000000000000000..5a4c05f0a9afbf6479b50155db28aaf49ba36e2e Binary files /dev/null and b/product/tablet/src/main/resources/rawfile/lvyou.png differ diff --git a/product/tablet/src/main/resources/rawfile/normalize.css b/product/tablet/src/main/resources/rawfile/normalize.css new file mode 100644 index 0000000000000000000000000000000000000000..6c65c4649716b2967e0d2a4996082d429a20a636 --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/normalize.css @@ -0,0 +1,426 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} + +ul { + line-height: "5px"; + padding-inline-start: 30px; + margin-block-start: 0px; + margin-block-end: 0px; +} + +ol { + line-height: "5px"; + padding-inline-start: 30px; + margin-block-start: 0px; + margin-block-end: 0px; +} \ No newline at end of file diff --git a/product/tablet/src/main/resources/rawfile/rich_editor.js b/product/tablet/src/main/resources/rawfile/rich_editor.js new file mode 100644 index 0000000000000000000000000000000000000000..b494687e582ac0c7003c2921d4c474b7a947ef1a --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/rich_editor.js @@ -0,0 +1,636 @@ +/** + * Copyright (C) 2017 Wasabeef + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var RE = {}; +var isInit = false +RE.currentSelection = { + "startContainer": 0, + "startOffset": 0, + "endContainer": 0, + "endOffset": 0 +}; + +RE.editor = document.getElementById('editor'); + +function load() { + addSelectionChange(); +} + +function addSelectionChange() { + window.document.addEventListener("selectstart", onSelectionChanged, false); + window.document.addEventListener("selectionchange", onSelectionChanged, false); +} + +document.addEventListener("selectionchange", function() { + if(!isInit&&(document.innerHTML == "undefined" || document.innerHTML == null || document.innerHTML == "")){ + isInit = true + //初始化 java代码直接设置不行 必须在此时选中后 + console.log("初始化-默认style") + document.execCommand("fontSize", false, 3); + RE.fixFontSize() + }else{ + RE.backuprange(); + } + + } + ); + +// Initializations +RE.callback = function() { + RE.setLiVal(); + if (window.inputCallBack && window.inputCallBack.call) { + inputCallBack.call("callback://" + encodeURI(RE.getHtml())); + } +} + +RE.setHtml = function(contents) { + RE.editor.innerHTML = decodeURIComponent(contents.replace(/\+/g, '%20')); +} + + +RE.getHtml = function() { + return RE.editor.innerHTML; +} + +RE.getText = function() { + console.log(RE.editor.innerText); + return RE.editor.innerText; +} + +RE.setBaseTextColor = function(color) { + RE.editor.style.color = color; +} + +RE.setBaseFontSize = function(size) { + RE.editor.style.fontSize = size; +} + +RE.setPadding = function(left, top, right, bottom) { + RE.editor.style.paddingLeft = left; + RE.editor.style.paddingTop = top; + RE.editor.style.paddingRight = right; + RE.editor.style.paddingBottom = bottom; +} + +RE.setBackgroundColor = function(color) { + document.body.style.backgroundColor = color; +} + +RE.setBackgroundImage = function(image) { + RE.editor.style.backgroundImage = image; +} + +RE.setWidth = function(size) { + RE.editor.style.minWidth = size; +} + +RE.setHeight = function(size) { + RE.editor.style.height = size; +} + +RE.setTextAlign = function(align) { + RE.editor.style.textAlign = align; +} + +RE.setVerticalAlign = function(align) { + RE.editor.style.verticalAlign = align; +} + +RE.setPlaceholder = function(placeholder) { + RE.editor.setAttribute("placeholder", placeholder); +} + +RE.setInputEnabled = function(inputEnabled) { + RE.editor.contentEditable = String(inputEnabled); +} + +RE.undo = function() { + document.execCommand('undo', false, null); +} + +RE.redo = function() { + document.execCommand('redo', false, null); +} + +RE.setBold = function() { + document.execCommand('bold'); +} + +RE.setItalic = function() { + document.execCommand('italic', false, null); +} + +RE.setSubscript = function() { + document.execCommand('subscript', false, null); +} + +RE.setSuperscript = function() { + document.execCommand('superscript', false, null); +} + +RE.setStrikeThrough = function() { + document.execCommand('strikeThrough', false, null); +} + +RE.setUnderline = function() { + document.execCommand('underline', false, null); +} + +RE.setNumbers = function () { + document.execCommand('insertOrderedList', false, null); + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "OL") { + child.style["list-style"] = "decimal"; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } +} + +RE.setABC = function () { + document.execCommand('insertOrderedList', false, null); + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "OL") { + child.style["list-style"] = "lower-alpha"; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } +} + +RE.setBullets = function () { + document.execCommand('insertUnorderedList', false, null); + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "UL") { + child.style["list-style"] = "disc"; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } +} + +RE.setSquare = function () { + document.execCommand('insertUnorderedList', false, null); + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "UL") { + child.style["list-style"] = "square"; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } +} + +RE.setTextColor = function (color) { + document.execCommand('foreColor', false, color); +} + +RE.setTextBackgroundColor = function(color) { + RE.restorerange(); + document.execCommand("styleWithCSS", null, true); + document.execCommand('hiliteColor', false, color); + document.execCommand("styleWithCSS", null, false); +} + +RE.setFontSize = function(fontSize){ + document.execCommand("fontSize", false, fontSize); +} + +RE.execFontSize = function (size, unit) { + document.execCommand("fontSize", false, "7"); + var fontElements = window.getSelection().anchorNode.parentNode + fontElements.removeAttribute("size"); + fontElements.style.fontSize = size + 'px' +}; + + +RE.setHeading = function(heading) { + document.execCommand('formatBlock', false, ''); +} + +RE.setIndent = function() { + document.execCommand('indent', false, null); +} + +RE.setOutdent = function() { + document.execCommand('outdent', false, null); +} + +RE.setJustifyLeft = function() { + document.execCommand('justifyLeft', false, null); +} + +RE.setJustifyCenter = function() { + document.execCommand('justifyCenter', false, null); +} + +RE.setJustifyRight = function() { + document.execCommand('justifyRight', false, null); +} + +RE.setBlockquote = function() { + document.execCommand('formatBlock', false, '
'); +} + +//RE.insertImage = function(url) { +// var html = '

picvision

'; +// RE.insertHTML(html); +// RE.editor.scrollIntoView(false) +//} + +RE.insertImage = function() { + var url = './baidu.png'; + var html = '

picvision

'; + RE.insertHTML(html); + RE.editor.scrollIntoView(false) +} +//  让其可以继续进去编辑模式 +RE.insertVideo = function(url,custom,posterUrl) { + var html = '  

'; + RE.insertHTML(html); + RE.editor.scrollIntoView(false) + } + +RE.insertAudio = function(url,custom) { + var html = '  

'; + RE.insertHTML(html); + RE.editor.scrollIntoView(false) +} + +RE.insertHTML = function(html) { + RE.restorerange(); + document.execCommand('insertHTML', false, html); +} + +RE.insertLink = function(url, title) { + RE.restorerange(); + var sel = document.getSelection(); + if (sel.toString().length == 0) { + document.execCommand("insertHTML",false,""+title+""); + } else if (sel.rangeCount) { + var el = document.createElement("a"); + el.setAttribute("href", url); + el.setAttribute("title", title); + + var range = sel.getRangeAt(0).cloneRange(); + range.surroundContents(el); + sel.removeAllRanges(); + sel.addRange(range); + } + RE.callback(); +} + +RE.setDone = function() { + var html = '  '; + document.execCommand('insertHTML', false, html); +} + +RE.addTodo=function(e){ + KEY_ENTER=13; + if(e.which == KEY_ENTER){ + var node=RE.getSelectedAnchorNode(); + if(node&&node.nodeName=="#text"){ + node=node.parentElement; + } + if(node&&node.nodeName=="SPAN"&&node.previousElementSibling&&node.previousElementSibling.className=='note-checkbox'){ + RE.setTodo(); + e.preventDefault(); + } + } +} + +RE.setTodo = function () { + var parent = document.getElementById('editor') + var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; + var html = (isContentEmpty ? '' : '
') + ' '; + document.execCommand('insertHTML', false, html); +} + +function onCheckChange(checkbox) { + if (checkbox.checked == true) { + checkbox.setAttribute("checked", "checked"); + } else { + checkbox.removeAttribute("checked"); + } +} + +RE.prepareInsert = function() { + RE.backuprange(); +} + +RE.backuprange = function(){ + console.log("backuprange"); + var selection = window.getSelection(); + if (selection.rangeCount > 0) { + var range = selection.getRangeAt(0); + RE.currentSelection = { + "startContainer": range.startContainer, + "startOffset": range.startOffset, + "endContainer": range.endContainer, + "endOffset": range.endOffset}; + } +} + +RE.restorerange = function(){ + var selection = window.getSelection(); + selection.removeAllRanges(); + var range = document.createRange(); + range.setStart(RE.currentSelection.startContainer, RE.currentSelection.startOffset); + range.setEnd(RE.currentSelection.endContainer, RE.currentSelection.endOffset); + selection.addRange(range); +} + +RE.enabledEditingItems = function(e) { + + var items = []; + if (document.queryCommandState('bold')) { + items.push('bold'); + } + if (document.queryCommandState('italic')) { + items.push('italic'); + } + if (document.queryCommandState('subscript')) { + items.push('subscript'); + } + if (document.queryCommandState('superscript')) { + items.push('superscript'); + } + if (document.queryCommandState('strikeThrough')) { + items.push('strikeThrough'); + } + if (document.queryCommandState('underline')) { + items.push('underline'); + } + if (document.queryCommandState('insertOrderedList')) { + items.push('orderedList'); + } + if (document.queryCommandState('insertUnorderedList')) { + items.push('unorderedList'); + } + if (document.queryCommandState('justifyCenter')) { + items.push('justifyCenter'); + } + if (document.queryCommandState('justifyFull')) { + items.push('justifyFull'); + } + if (document.queryCommandState('justifyLeft')) { + items.push('justifyLeft'); + } + if (document.queryCommandState('justifyRight')) { + items.push('justifyRight'); + } + if (document.queryCommandState('insertHorizontalRule')) { + items.push('horizontalRule'); + } + var formatBlock = document.queryCommandValue('formatBlock'); + if (formatBlock.length > 0) { + items.push(formatBlock); + } + console.log("HwNotePad items:" + items) + window.location.href = "re-state://" + encodeURI(items.join(',')); +} + +RE.focus = function() { + var range = document.createRange(); + range.selectNodeContents(RE.editor); + range.collapse(false); + var selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + RE.editor.focus(); +} + +RE.blurFocus = function() { + RE.editor.blur(); +} + +RE.removeFormat = function() { + document.execCommand('removeFormat', false, null); +} + +// Event Listeners +RE.editor.addEventListener("input", RE.callback); + + + + +RE.editor.addEventListener("keydown", function(e) { + RE.addTodo(e); +}); +RE.editor.addEventListener("keyup", function(e) { + var KEY_LEFT = 37, KEY_RIGHT = 39; + if (e.which == KEY_LEFT || e.which == KEY_RIGHT) { + RE.enabledEditingItems(e); + } +}); +//RE.editor.addEventListener("click", RE.enabledEditingItems); + +RE.fixFontSize = function(){ + var font = document.querySelectorAll('font') + if(!font){ + return + } + font.forEach(function(item) { + + if (item.getAttribute('size') == '1') { + item.style.fontSize='12px'; + console.log("fixFontSize 12px"); + } else if (item.getAttribute('size') == '2') { + item.style.fontSize='14px'; + console.log("fixFontSize 14px"); + } else if (item.getAttribute('size') == '3') { + item.style.fontSize='16px'; + console.log("fixFontSize 16px"); + } else if (item.getAttribute('size') == '4') { + item.style.fontSize='18px'; + console.log("fixFontSize 18px"); + } else if (item.getAttribute('size') == '5') { + item.style.fontSize='20px'; + console.log("fixFontSize 20px"); + } else if (item.getAttribute('size') == '6') { + item.style.fontSize='22px'; + console.log("fixFontSize 22px"); + } else { + console.log("fixFontSize null"); + } + item.removeAttribute("size") + console.log("fixFontSize End"); + +}); +} + +RE.removeFormat = function() { + document.execCommand('removeFormat', false, null); +} + + +//获取当前光标所在内包含的所有样式 +RE.getSelectedNode = function() { + var node,selection; + if (window.getSelection) { + selection = getSelection(); + node = selection.anchorNode; + } + if (!node && document.selection) { + selection = document.selection + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + node = range.commonAncestorContainer ? range.commonAncestorContainer : + range.parentElement ? range.parentElement() : range.item(0); + } + if (node) { + var item = (node.nodeName == "#text" ? node.parentNode : node); + console.log("innerHTML:"+item.innerHTML); + console.log("font-size:"+item.style["font-size"]); + console.log("color:"+item.getAttribute("color")); + console.log("queryCommandState1 bold:"+document.queryCommandState('bold')); + + console.log("src:"+item.getAttribute("src")); + console.log(item.style["font-size"]+"|"+item.getAttribute("color")+"|"+document.queryCommandState('bold')) + + } +} + +//获取光标开始位置归属节点 +RE.getSelectedAnchorNode=function(){ + var node,selection; + if (window.getSelection) { + selection = getSelection(); + node = selection.anchorNode; + } + if (!node && document.selection) { + selection = document.selection + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + node = range.commonAncestorContainer ? range.commonAncestorContainer : + range.parentElement ? range.parentElement() : range.item(0); + } + return node; +} + +function getHtmlCallToApp() { + if (window.getHtmlByJs && window.getHtmlByJs.call) { + getHtmlByJs.call("callback://" + encodeURI(RE.getHtml())); + } +} + +RE.setLiVal=function(){ + var liArr=RE.editor.getElementsByTagName("li"); + var type="1"; + var val=1; + var len=liArr.length; + for(var i=0;i0){ + val=val+1; + } + else{ + type=liArr[i].getAttribute("type"); + val=1; + } + liArr[i].setAttribute("value",val); + } +} + +RE.insertLine = function() { + var html = '


'; + RE.insertHTML(html); + } + +function show_alert() { + alert('this is alert dialog!'); +} + + +function change_test1() { + var test = document.getElementById('test'); + //alert(test.innerText); + test.innerText = '新的测试' + // test.style.fontSize = '30px' + RE.setBold() +} + +function change_test2() { + RE.setItalic() +} +function change_test3() { + RE.setBullets() +} +function change_test4() { + RE.setJustifyCenter() +} + +function get_html_content() { + console.log('hhh Ark WebComponent'); + //str=objName.test("from Html", "6cxfd", 123); + var htmlString = encodeURI(RE.getHtml()) + var str = callBackToApp.callbackhtml(htmlString) + console.log('hhh objName.test result:' + str); +} + + diff --git a/product/tablet/src/main/resources/rawfile/shuxue.png b/product/tablet/src/main/resources/rawfile/shuxue.png new file mode 100644 index 0000000000000000000000000000000000000000..8af342a8d6b761f78c9e28f8a3bf1d84ead54ba4 Binary files /dev/null and b/product/tablet/src/main/resources/rawfile/shuxue.png differ diff --git a/product/tablet/src/main/resources/rawfile/style.css b/product/tablet/src/main/resources/rawfile/style.css new file mode 100644 index 0000000000000000000000000000000000000000..edc103daae09c2860eadab5c6a352722c55e46ae --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/style.css @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2017 Wasabeef + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@charset "UTF-8"; + + +html { + height: 100%; +} + + +body { + overflow: scroll; + display: table; + table-layout: fixed; + width: 100%; + min-height:100%; + color: #333333; +} + +#editor { + padding-left: 24px; + padding-right: 24px; + width:100%; + display: table-cell; + outline: 0px solid transparent; + background-repeat: no-repeat; + background-position: center; + background-size: cover; + color: #333333; + font-size:40px; +} + +#editor[placeholder]:empty:not(:focus):before { + content: attr(placeholder); + font-size:40px; + color: #9b9b9b; +} diff --git a/product/tablet/src/main/resources/rawfile/text_format_manager.js b/product/tablet/src/main/resources/rawfile/text_format_manager.js new file mode 100644 index 0000000000000000000000000000000000000000..bf393922883a4bd87ab59d5dd46307fcc4eb4337 --- /dev/null +++ b/product/tablet/src/main/resources/rawfile/text_format_manager.js @@ -0,0 +1,344 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var mNeedToUpdateToolbarState = false; + +function command(name) { + document.execCommand(name); +} + +function setFontSize(value) { + console.log("setFontSize() value : " + value); + document.execCommand("fontSize", false, value); +} + +/** Font size change feature */ +function getFontSize() { + var fontSize = document.queryCommandValue('fontSize'); + console.log("get current fontSize : " + fontSize); + fontSize = getSupportedFontSize(fontSize); + return fontSize; +} + +function getSupportedFontSize(fontSize) { + var result = 16; + switch (parseInt(fontSize)) { + case 1: + result = 12; + break; + case 2: + result = 14; + break; + case 3: + result = 16; + break; + case 4: + result = 18; + break; + case 5: + result = 20; + break; + case 6: + result = 22; + break; + default: + break; + } + console.log("get supported fontSize : " + result); + return result; +} + +function setForeColor(value) { + console.log("setForeColor() value : " + value); + document.execCommand("foreColor", false, value); +} + +function getFontColor() { + var fontColor = document.queryCommandValue('foreColor'); + console.log("get current fontColor : " + fontColor); + return fontColor; +} + +function updateRichTextState() { + var result = 0x0; + var boldState = getCurrentBoldState(); + result |= boldState; + + var italicState = getCurrentItalicState(); + result |= italicState; + + var underlineState = getCurrentUnderlineState(); + result |= underlineState; + + var orderedListState = getCurrentOrderedListState(); + result |= orderedListState; + + var unorderedListState = getCurrentUnorderedListState(); + result |= unorderedListState; + + var alignLeftState = getCurrentAlignLeftState(); + result |= alignLeftState; + + var alignCenterState = getCurrentAlignCenterState(); + result |= alignCenterState; + + var alignRightState = getCurrentAlignRightState(); + result |= alignRightState; + + // font size + var fontSize = getFontSize(); + + // font color + var foreColor = getFontColor(); + + var undoState = getCurrentUndoState(); + result |= undoState; + + var redoState = getCurrentRedoState(); + result |= redoState; + + if (window.updateRichEditStateFinished && window.updateRichEditStateFinished.call) { + updateRichEditStateFinished.call(result + "&" + fontSize + "&" + foreColor); + } +} + +function getCurrentUndoState() { + var undoState = 0x0; + var canUndo = document.queryCommandEnabled("undo"); + if (canUndo == true) { + undoState |= 0x400; + } + return undoState; +} + +function getCurrentRedoState() { + var redoState = 0x0; + var canRedo = document.queryCommandEnabled("redo"); + if (canRedo == true) { + redoState |= 0x800; + } + return redoState; +} + +function getCurrentAlignLeftState() { + var alignLeftState = 0x0; + var state = document.queryCommandState("justifyLeft"); + var indeterm = document.queryCommandIndeterm("justifyLeft"); + if (state == true) { + alignLeftState |= 0x1000; + } else if (state == false) { + if (indeterm == true) { + alignLeftState |= 0x2000; + } else { + alignLeftState |= 0x0; + } + } else if (state == null) { + alignLeftState |= 0x0; + } + return alignLeftState; +} + +function getCurrentAlignCenterState() { + var alignCenterState = 0x0; + var state = document.queryCommandState("justifyCenter"); + var indeterm = document.queryCommandIndeterm("justifyCenter"); + if (state == true) { + alignCenterState |= 0x4000; + } else if (state == false) { + if (indeterm == true) { + alignCenterState |= 0x8000; + } else { + alignCenterState |= 0x0; + } + } else if (state == null) { + alignCenterState |= 0x0; + } + return alignCenterState; +} + +function getCurrentAlignRightState() { + var alignRightState = 0x0; + var state = document.queryCommandState("justifyRight"); + var indeterm = document.queryCommandIndeterm("justifyRight"); + if (state == true) { + alignRightState |= 0x10000; + } else if (state == false) { + if (indeterm == true) { + alignRightState |= 0x20000; + } else { + alignRightState |= 0x0; + } + } else if (state == null) { + alignRightState |= 0x0; + } + return alignRightState; +} + +function getCurrentOrderedListState() { + var orderedListState = 0x0; + var state = document.queryCommandState("insertOrderedList"); + var indeterm = document.queryCommandIndeterm("insertOrderedList"); + + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "OL") { + type = child.style["list-style"]; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } + if (state == true) { + if (type == "lower-alpha") { + orderedListState |= 0x40000; + } else { + orderedListState |= 0x40; + } + } else if (state == false) { + if (indeterm == true) { + orderedListState |= 0x80; + } else { + orderedListState |= 0x0; + } + } else if (state == null) { + orderedListState |= 0x0; + } + return orderedListState; +} + +function getCurrentUnorderedListState() { + var unorderedListState = 0x0; + var state = document.queryCommandState("insertUnorderedList"); + var indeterm = document.queryCommandIndeterm("insertUnorderedList"); + + var selection, type; + if (window.getSelection) { + selection = getSelection(); + } + if (selection) { + var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); + try { + var child = range.commonAncestorContainer.parentNode; + for (var i = 0; i < 10; i++) { + if (child.nodeName == "UL") { + type = child.style["list-style"]; + break; + } + if (child.parentNode) { + child = child.parentNode + } + } + } catch (err) { + + } + } + if (state == true) { + if (type == "square") { + unorderedListState |= 0x100000; + } else { + unorderedListState |= 0x100; + } + } else if (state == false) { + if (indeterm == true) { + unorderedListState |= 0x200; + } else { + unorderedListState |= 0x0; + } + } else if (state == null) { + unorderedListState |= 0x0; + } + return unorderedListState; +} + +function getCurrentUnderlineState() { + var underlineState = 0x0; + var state = document.queryCommandState("underline"); + var indeterm = document.queryCommandIndeterm("underline"); + if (state == true) { + underlineState |= 0x10; + } else if (state == false) { + if (indeterm == true) { + underlineState |= 0x20; + } else { + underlineState |= 0x0; + } + } else if (state == null) { + underlineState |= 0x0; + } + return underlineState; +} + +function getCurrentItalicState() { + var italicState = 0x0; + var state = document.queryCommandState("italic"); + var indeterm = document.queryCommandIndeterm("italic"); + if (state == true) { + italicState |= 0x4; + } else if (state == false) { + if (indeterm == true) { + italicState |= 0x8; + } else { + italicState |= 0x0; + } + } else if (state == null) { + italicState |= 0x0; + } + return italicState; +} + +function getCurrentBoldState() { + var boldState = 0x0; + var state = document.queryCommandState("bold"); + var indeterm = document.queryCommandIndeterm("bold"); + if (state == true) { + boldState |= 0x1; + } else if (state == false) { + if (indeterm == true) { + boldState |= 0x2; + } else { + boldState |= 0x0; + } + } else if (state == null) { + boldState |= 0x0; + } + return boldState; +} + +function onSelectionChanged(event) { + switch (event.type) { + case "selectstart": + mNeedToUpdateToolbarState = true; + break; + case "selectionchange": + { + if (mNeedToUpdateToolbarState) { + updateRichTextState(); + } + } + break; + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..24624c5d119381cac7d22271b57c06b1eb5233be --- /dev/null +++ b/settings.gradle @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +include ':phone', ':tablet', ':pc',':common:utils', ':common:component' + +project(':tablet').projectDir = new File('./product/tablet') +project(':phone').projectDir = new File('./product/phone') +project(':pc').projectDir = new File('./product/pc') +