diff --git a/common/component/src/main/ets/default/CusDialogComp.ets b/common/component/src/main/ets/default/CusDialogComp.ets index 959e2dade5c8ce76224032a2a0999eec84cc433a..563ac53b13c6b7d87f591425558d1e94fcb2dc73 100644 --- a/common/component/src/main/ets/default/CusDialogComp.ets +++ b/common/component/src/main/ets/default/CusDialogComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -59,7 +59,7 @@ export struct NewOrEditFolderDialog { .placeholderFont({ size: 18 }) .maxLength(20) .borderRadius(15) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.New_folder_input_box_color")) .width('90%') .onChange((value: string) => { this.inputName = value @@ -72,9 +72,10 @@ export struct NewOrEditFolderDialog { Text($r("app.string.category_already_exist")) .fontSize(10) .margin({ left: 64 }) - .fontColor("#FA2A2D") + .fontColor($r("app.color.category_already_exist_font_color")) .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) - Divider().height(1) + Divider() + .height(1) .margin({ left: 64, right: 24 }) .color($r("app.color.divider_color_182431")) // button group @@ -114,7 +115,7 @@ export struct NewOrEditFolderDialog { } .width(336) .borderRadius(36) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.create_folder_bg_color")) .alignItems(HorizontalAlign.Start) .margin({ bottom: 16, left: 12, right: 12 }) } @@ -242,7 +243,7 @@ export struct DeleteDialog { .height(117) .borderRadius(36) .padding({ top: 24, bottom: 16, left: 16, right: 16 }) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.delete_note_bg_color")) .margin({ bottom: 16, left: 12, right: 12 }) } } @@ -335,7 +336,7 @@ export struct NoteDataMoveDialog { .borderRadius(36) .height(this.AllFolderArray.length > 12 ? 616 : (this.AllFolderArray.length - 1) * 56) .padding({ left: 24, right: 24 }) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.choose_folder_bg_color")) .margin({ bottom: 16, left: 12, right: 12 }) } } @@ -618,7 +619,7 @@ export struct EditTitleDialog { .placeholderFont({ size: 18 }) .maxLength(20) .borderRadius(15) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.title_input_bg_color")) .width('90%') .onChange((value: string) => { this.inputName = value @@ -657,7 +658,7 @@ export struct EditTitleDialog { } .width(336) .borderRadius(36) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.Edit_title_bg_color")) .alignItems(HorizontalAlign.Start) .margin({ bottom: 16, left: 12, right: 12 }) } diff --git a/common/component/src/main/ets/default/FolderListComp.ets b/common/component/src/main/ets/default/FolderListComp.ets index a1f6d7f804209ae001774815f59a33c5718afdb6..56199f62546d4ab29482a62e35fd34f3875b865e 100644 --- a/common/component/src/main/ets/default/FolderListComp.ets +++ b/common/component/src/main/ets/default/FolderListComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,6 +41,7 @@ export struct FolderListComp { .onClick(() => { if (this.sectionStatus == 1) { this.expandStatus = !this.expandStatus + AppStorage.SetOrCreate('ContinueExpand', this.expandStatus) } else { this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) // 迁移 @@ -232,11 +233,9 @@ struct FolderItemComp { this.selectedFolderData = FolderUtil.getFolderData(this.AllFolderArray, SysDefFolderUuid.AllNotes) this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, SysDefFolderUuid.AllNotes) // save continue data - let continueFolder: string = JSON.stringify(this.selectedFolderData.toFolderObject()) let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueFolder', continueFolder) AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(this.TAG, "onDeleteConfirm, set continue folder and note success") + LogUtil.info(this.TAG, "onDeleteConfirm, set continue note success") } } // Folder Create Dialog @@ -318,7 +317,7 @@ struct FolderItemComp { .height(154) .padding({ top: 4, bottom: 4, left: 16, right: 16 }) .borderRadius(16) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.press_folder_bg_color")) .visibility(this.folderItem.folder_type == FolderType.CusDef ? Visibility.Visible : Visibility.None) } @@ -365,12 +364,10 @@ struct FolderItemComp { // 刷新web界面 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) // save continue data - let continueFolder: string = JSON.stringify(this.selectedFolderData.toFolderObject()) let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueFolder', continueFolder) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', 3) - LogUtil.info(this.TAG, "FolderItemComp, set continue folder and note success") + LogUtil.info(this.TAG, "FolderItemComp, set continue note success") } }) } diff --git a/common/component/src/main/ets/default/NoteContentComp.ets b/common/component/src/main/ets/default/NoteContentComp.ets index 83b5684575b3d6901f73ef0acf460044b8a1ca73..99bb279df3c2e79c583bf0b9b8bf2e1927752d77 100644 --- a/common/component/src/main/ets/default/NoteContentComp.ets +++ b/common/component/src/main/ets/default/NoteContentComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -84,6 +84,12 @@ export struct NoteContentComp { LogUtil.info(TAG, "selectedNoteData note:" + this.selectedNoteData.uuid) this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"}) } + this.sectionStatus = this.lastSectionStatus + this.sectionStatus = mediaquery.matchMediaSync('(width < 2000)').matches ? 2 : 3 + // save continue data + LogUtil.info(TAG, "callbackhtmlSave, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + LogUtil.info(TAG, "callbackhtmlSave, set continue section success") return "AceString" }, @@ -123,7 +129,7 @@ export struct NoteContentComp { .onPageEnd((e) => { if (this.editContentFlag == false) { this.controllerShow.registerJavaScriptProxy({ - obj: this.noteContent, + object: this.noteContent, name: "callBackToApp", // html--> name.method methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave"], }) @@ -144,7 +150,6 @@ export struct NoteContentComp { } .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(() => { // 点击第三屏进入全屏编辑模式 @@ -153,22 +158,20 @@ export struct NoteContentComp { this.sectionStatus = 1 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) this.editModel = !this.editModel - // 添加定时器:5s自动保存 + // 添加定时器:3s自动保存 timeId = setInterval(() => { this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) - }, 5000) - LogUtil.info(TAG, "NoteContentComp, setInterval timeId : " + timeId) + }, 3000) + LogUtil.info(TAG, "setInterval timeId : " + timeId) // save continue data AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) - LogUtil.info(TAG, "NoteContentComp, set continue section success") + LogUtil.info(TAG, "set continue section success") } }) } .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) @@ -250,7 +253,8 @@ export struct NoteContentOverViewComp { Row() { Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))) .fontSize(12) - .padding({ top: 4, bottom: 4 }).fontColor('#A3A7AD') + .padding({ top: 4, bottom: 4 }) + .fontColor($r("app.color.modified_time_font_color")) Row() { Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) .fontSize(12) @@ -266,6 +270,7 @@ export struct NoteContentOverViewComp { .bindMenu(this.MenuBuilder) }.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100) } + .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) .width(StyleConstants.PERCENTAGE_100) .height(80) } @@ -285,19 +290,12 @@ export struct ToolBarComp { 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) { @@ -318,6 +316,7 @@ export struct ToolBarComp { this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) @@ -338,48 +337,37 @@ export struct ToolBarComp { 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: "RICH_EDITOR.setInputEnabled(true)" }) - } else { - if (this.lastSectionStatus != undefined) { - // 切换为小屏预览模式 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - // 退出全屏时存库 - LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) - this.controllerShow.runJavaScript({ script: "save_html_content()" }) - this.sectionStatus = this.lastSectionStatus - this.sectionStatus = mediaquery.matchMediaSync('(width < 2000)').matches ? 2 : 3 - // 清除定时器 - if (timeId != undefined) { - LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId) - clearInterval(timeId) - } - } else { - this.sectionStatus = 3 + 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: "RICH_EDITOR.setInputEnabled(true)" }) + } else { + if (this.lastSectionStatus != undefined) { + // 切换为小屏预览模式 + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) + // 退出全屏时存库 + LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) + this.controllerShow.runJavaScript({ script: "save_html_content()" }) + // 清除定时器 + if (timeId != undefined) { + LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId) + clearInterval(timeId) } + } else { + this.sectionStatus = 3 } - this.editModel = !this.editModel - // 迁移 - LogUtil.info(TAG, "ToolBarComp, set continue section") - AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) - LogUtil.info(TAG, "ToolBarComp, set continue section success") - }) - .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) - } + } + this.editModel = !this.editModel + // 迁移 + LogUtil.info(TAG, "ToolBarComp, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + LogUtil.info(TAG, "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 }) { @@ -398,6 +386,7 @@ export struct ToolBarComp { prompt.showToast({ message: "已恢复", duration: 2000 }) this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // update note to db let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) @@ -411,38 +400,6 @@ export struct ToolBarComp { LogUtil.info(TAG, "recover, set continue note success") }) }.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:RICH_EDITOR.undo()" }) - }) - Image($r('app.media.todo')) - .height(24) - .width(24) - .onClick(() => { - this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" }) - }) - Image($r('app.media.tick_thin')) - .height(24) - .width(24) - .onClick(() => { - // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) - if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { - LogUtil.info(TAG, "note is empty,save note failed") - prompt.showToast({ message: $r('app.string.empty_note'), duration: 2000 }) - } - // 清除定时器 - if (timeId != undefined) { - LogUtil.info(TAG, "tick_thin, clearInterval timeId : " + timeId) - clearInterval(timeId) - } - }) - }.width(120) } else if (this.editModel == true) { Row({ space: StyleConstants.SPACE_6 }) { Button({ type: ButtonType.Normal, stateEffect: true }) { @@ -476,6 +433,33 @@ export struct ToolBarComp { Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.picture_white')).height(24).width(24) + .onClick(async () => { + LogUtil.info(TAG, 'startAbility start') + AppStorage.SetOrCreate('openPhoto', 1) + await globalThis.noteContext.startAbilityForResult({ + parameters: { uri: "singleselect" }, + bundleName: "com.ohos.photos", + abilityName: "com.ohos.photos.MainAbility", + }) + .then(v => { + AppStorage.SetOrCreate('openPhoto', 0) + let want = v['want']; + if (want != null && want != undefined) { + let param = want['parameters']; + let imageUri = "" + if (param != null && param != undefined) { + let uri = param['select-item-list']; + imageUri = uri; + } + // 拷贝 + OperationUtils.copy(imageUri).then((uriPath) => { + var path = "file://" + uriPath + LogUtil.info(TAG, 'image uri is:' + path) + this.controllerShow.runJavaScript({script:"javascript:RICH_EDITOR.insertImage('" + path + "')"}) + }) + } + }); + }) }.width(42) .height(42) .borderRadius(8) @@ -485,13 +469,6 @@ export struct ToolBarComp { Image($r('app.media.tick_thick')) .height(24) .width(24) - .onClick(() => { - // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) - if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { - LogUtil.info(TAG, "note is empty,save note failed") - } - }) }.width(42) .height(42) .borderRadius(8) @@ -547,11 +524,7 @@ export struct ToolBarComp { .height(24) .width(24) .onClick(() => { - if (this.portraitModel) { - this.noteDataDeleteDialogCtlBottom.open() - } else { - this.noteDataDeleteDialogCtl.open() - } + this.noteDataDeleteDialogCtl.open() }) }.width(72) } @@ -561,91 +534,6 @@ export struct ToolBarComp { } } -@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 - // save continue data - let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(TAG, "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[] = [] diff --git a/common/component/src/main/ets/default/NoteContentCompPortrait.ets b/common/component/src/main/ets/default/NoteContentCompPortrait.ets index 6fbd3d79d877d5de11b9b644e2538922e769badd..22aaa566eb7ddcd4b3d9e84b4f4bc79af2d2d9a9 100644 --- a/common/component/src/main/ets/default/NoteContentCompPortrait.ets +++ b/common/component/src/main/ets/default/NoteContentCompPortrait.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,8 +17,7 @@ import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUt 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 {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 {EditContentDialogPortrait, DeleteDialog, EditTitleDialog} from './CusDialogComp.ets' import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' @@ -28,7 +27,9 @@ import featureAbility from '@ohos.ability.featureAbility'; import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' import OperationUtils from '../../../../../../common/utils/src/main/ets/default/baseUtil/OperationUtils.ets' -const TAG = "NoteContentComp" +var timeId : number + +const TAG = "NoteContentCompPortrait" // Note content component @Component @@ -55,8 +56,29 @@ export struct NoteContentCompPortrait { predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid) - return "AceString"; + // save continue data + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + AppStorage.SetOrCreate('ContinueNote', continueNote) + LogUtil.info(TAG, "callbackhtml, set continue note success") + return "AceString" + }, + + callbackScheduledSave: (html) => { + LogUtil.info(TAG, 'callbackScheduledSave') + this.selectedNoteData.content_text = html + this.selectedNoteData.modified_time = new Date().getTime() + // updata note image + this.selectedNoteData.content_img = RdbStoreUtil.updataNoteImage(this.selectedNoteData.content_text) + 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, 'callbackScheduledSave, update note success:' + this.selectedNoteData.uuid) + // save continue data + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + AppStorage.SetOrCreate('ContinueNote', continueNote) + LogUtil.info(TAG, 'callbackScheduledSave, set continue note success') } + } build() { @@ -77,9 +99,9 @@ export struct NoteContentCompPortrait { .onPageEnd((e) => { if (this.editContentFlag == false) { this.controllerShow.registerJavaScriptProxy({ - obj: this.noteContent, + object: this.noteContent, name: "callBackToApp", // html--> name.method - methodList: ["callbackhtml"], + methodList: ["callbackhtml","callbackScheduledSave"], }); LogUtil.info(TAG, "finish register") this.controllerShow.refresh() @@ -103,6 +125,11 @@ export struct NoteContentCompPortrait { .onClick(() => { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) this.editModel = true + // 添加定时器:3s自动保存 + timeId = setInterval(() => { + this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + }, 3000) + LogUtil.info(TAG, "NoteContentCompPortrait, setInterval timeId : " + timeId) }) } .height(StyleConstants.PERCENTAGE_100) @@ -217,6 +244,12 @@ export struct ToolBarComp { // 进入预览模式 this.controllerShow.runJavaScript({ script: "RE.setInputEnabled(false)" }) this.editModel = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) + // 清除定时器 + if (timeId != undefined) { + LogUtil.info(TAG, "back, clearInterval timeId : " + timeId) + clearInterval(timeId) + } }) if (this.editModel == false) { @@ -274,6 +307,11 @@ export struct ToolBarComp { // 进入预览模式 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.editModel = false + // 清除定时器 + if (timeId != undefined) { + LogUtil.info(TAG, "tick_thin, clearInterval timeId : " + timeId) + clearInterval(timeId) + } }) }.width(42) .height(42) @@ -323,6 +361,7 @@ export struct DeleteNoteComp { this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) } build() { @@ -335,7 +374,8 @@ export struct DeleteNoteComp { this.noteDataDeleteDialogCtlBottom.open() }) Text($r("app.string.delete")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.delete_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -350,13 +390,15 @@ export struct DeleteNoteComp { prompt.showToast({ message: $r('app.string.restore'), duration: 2000 }) this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // 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') + .fontSize(10) + .fontColor($r('app.color.recover_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -401,7 +443,8 @@ export struct EditNoteCompForPortrait { this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) }) Text($r("app.string.list")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.list_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -414,7 +457,8 @@ export struct EditNoteCompForPortrait { this.editContentDialogCtl.open() }) Text($r("app.string.style")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.style_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -425,7 +469,8 @@ export struct EditNoteCompForPortrait { .height(24) Text($r("app.string.photo")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.photo_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) diff --git a/common/component/src/main/ets/default/NoteListComp.ets b/common/component/src/main/ets/default/NoteListComp.ets index 528cc182ced24f154108110e27e9a80e2d065821..6a8d73e907e0ad2472857d81e51189985c455721 100644 --- a/common/component/src/main/ets/default/NoteListComp.ets +++ b/common/component/src/main/ets/default/NoteListComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -87,6 +87,7 @@ struct NoteOverViewComp { .onClick(() => { if (this.sectionStatus == 1) { this.expandStatus = !this.expandStatus + AppStorage.SetOrCreate('ContinueExpand', this.expandStatus) } else { this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) // 迁移 @@ -104,16 +105,16 @@ struct NoteOverViewComp { }) { Text(FolderUtil.getFolderText(this.selectedFolderData)) .fontSize(30) - .fontColor('#182431') + .fontColor($r("app.color.all_notes_font_color")) .fontWeight(FontWeight.Bold) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row() { Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString()) .fontSize(14) - .fontColor('#A3A7AD') + .fontColor($r("app.color.num_of_notes_font_color")) Text($r("app.string.noteslist")) .fontSize(14) - .fontColor('#A3A7AD') + .fontColor($r("app.color.num_of_notes_font_color")) .textOverflow({ overflow: TextOverflow.Ellipsis }) } .visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible) @@ -130,7 +131,7 @@ struct NoteOverViewComp { }) Text(this.CheckedNoteArray.length == 0 ? $r("app.string.none_selected") : $r("app.string.selected", this.CheckedNoteArray.length)) .fontSize(20) - .fontColor('#182431') + .fontColor($r("app.color.note_selected_font_color")) .margin({ left: 16 }) .textOverflow({ overflow: TextOverflow.Ellipsis }) }.alignItems(VerticalAlign.Center) @@ -180,9 +181,9 @@ export struct NoteItemComp { }), item => { if (item.data.type == 0) { - Span(item.data.text).fontColor('#182431').fontSize(16).fontWeight(FontWeight.Medium) + Span(item.data.text).fontColor($r("app.color.note_title_font_color")).fontSize(16).fontWeight(FontWeight.Medium) } else if (item.data.type == 1) { - Span(item.data.text).fontColor(Color.Blue).fontSize(16).fontWeight(FontWeight.Medium) + Span(item.data.text).fontColor($r("app.color.note_title_font_color_blue")).fontSize(16).fontWeight(FontWeight.Medium) } }, item => item.index) @@ -192,7 +193,7 @@ export struct NoteItemComp { Row({ space: 4 }) { Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time))) .fontSize(14) - .fontColor('#99182431') + .fontColor($r("app.color.list_modified_time_font_color")) .fontWeight(FontWeight.Regular) .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r("app.media.favorite")) @@ -255,6 +256,7 @@ export struct NoteItemComp { } else { this.selectedNoteData = this.noteItem this.chooseNote = true + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) @@ -325,7 +327,7 @@ export struct NoteItemListComp { Flex({ justifyContent: FlexAlign.Center }) { Text($r("app.string.permanently_delete_tips")) .fontSize(12) - .fontColor('#18181A') + .fontColor($r("app.color.Recently_delete_prompt_font_color")) } .margin({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 }) .width('100%') @@ -340,7 +342,7 @@ export struct NoteItemListComp { .height(120) Text($r("app.string.Empty_page")) .fontSize(12) - .fontColor('#A3A7AD') + .fontColor($r("app.color.Empty_page_font_color")) } } .width('100%') @@ -565,6 +567,7 @@ export struct AddNoteComp { } this.editModel = true this.chooseNote = true + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) @@ -593,9 +596,9 @@ export struct SearchComp { Flex({ justifyContent: FlexAlign.Start }) { Image($r('app.media.search')).width(18).height(18) - TextInput({ text: this.inputKeyword, placeholder: $r('app.string.searchNote') }) + TextInput({ placeholder: $r('app.string.searchNote') }) .backgroundColor($r("app.color.color_ffffff")) - .caretColor('#F86D05') + .caretColor($r("app.color.search_note_caret_color")) .onChange((value: string) => { LogUtil.info(TAG, "Search value: " + value) this.inputKeyword = value @@ -700,7 +703,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.set_top")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.set_top_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -717,7 +720,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.delete")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.delete_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -734,7 +737,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.move")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.move_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -764,7 +767,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.recover")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.recover_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -788,7 +791,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.check_all")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.check_all_font_color")) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) diff --git a/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets b/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets index 3756840b9ebdff41f797714e05314ca1f0a636c2..6022ad51c16e5b73b4c712c3bf61d458cdd01d0c 100644 --- a/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets +++ b/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from '../baseUtil/LogUtil.ets' import MediaLib from '@ohos.multimedia.mediaLibrary'; diff --git a/common/utils/src/main/ets/default/baseUtil/DateUtil.ets b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets index af971c413977b9133feb71e27a1b4b7a5cc21bee..4e68264528738e9be9a5eb0861582ccd5f7fcc88 100644 --- a/common/utils/src/main/ets/default/baseUtil/DateUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets deleted file mode 100644 index 09eb7d11f4cb7838a1bf55935f62d9abc8d44f50..0000000000000000000000000000000000000000 --- a/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets +++ /dev/null @@ -1,62 +0,0 @@ -/** - * 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, "folderDataUuid : " + JSON.stringify(folderData.uuid)) - } - for (let noteData of noteDataArray) { - LogUtil.info(TAG, "noteDataArrayUuid : " + JSON.stringify(noteData.uuid)) - } - 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 index 33ca9807d9e4e551c821fad8478240c411a10218..460be37148220cbe7091b6002b43c08dc29e15cb 100644 --- a/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * 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' diff --git a/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets index edfa97019f4b23c54d39e834e3046d7e0dd33de1..9ceac318a95d41456a5e9e9ae51889e9f3312b35 100644 --- a/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets +++ b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import Rsm from '@ohos.resourceManager'; import {LogUtil} from './LogUtil.ets' @@ -21,7 +22,7 @@ export class GlobalResourceManager { public async getStringByResource(res: any): Promise { let json = JSON.parse(JSON.stringify(res)); let id = json.id; - LogUtil.info(TAG, "ResourceID = %d" + id) + LogUtil.info(TAG, "ResourceID = " + id) return await this.getStringById(id); } diff --git a/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets index 514e43bdd9294349b114380f73b9197c49d8a312..0e867fa8e8817e3c2073f56d70fe7fa08091f46b 100644 --- a/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/LogUtil.ets b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets index 85689be912b8e0a9cf395b65ef512e81dc6dddc3..0f5a5619800af7db49ab471d2a6cd33d50a437bf 100644 --- a/common/utils/src/main/ets/default/baseUtil/LogUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets index 851a7bd9cf71335b708f7ab6e444fe90978006c8..73d66ddaaee689e145e5089734cf4e4ddf76f603 100644 --- a/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,10 +12,13 @@ * 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 {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 {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' @@ -141,7 +144,7 @@ export class NoteUtil { if (folderData.color == "#ffffff") { return "#FFEBE1" } - LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + isSelected.toString() + folderData.color.toString()) + LogUtil.info(TAG, "isSelected " + isSelected.toString() + ", folderData.color: " + folderData.color.toString()) return isSelected ? selectedNoteBgColorMap[folderData.color] : unSelectedNoteBgColorMap[folderData.color] } @@ -158,7 +161,7 @@ export class NoteUtil { LogUtil.info(TAG, "NoteBgColor is ffffff") return $r("app.color.color_ffffff") } - LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + folderData.color.toString()) + LogUtil.info(TAG, "isSelected " + folderData.color.toString() + ", folderData.color: " + folderData.color.toString()) if (folderData.color == "#ffffff") { return "#ff9516" } @@ -249,16 +252,16 @@ export class NoteUtil { index == -1 ? null : allNoteDataArray.splice(index, 1) } - deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[],controllerShow: WebController):boolean { + deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[], controllerShow: WebController): boolean { if (selectedNoteData.title == "标题" && selectedNoteData.content_text == "") { - // delete note from db - noteUtil.removeNoteData(AllNoteArray,selectedNoteData.uuid) - 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) - return true + // delete note from db + noteUtil.removeNoteData(AllNoteArray, selectedNoteData.uuid) + 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) + return true } return false } diff --git a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets index 7ece3f5d78d15565565cefe0237f86cf8a2fa005..eb3a43c45d4d0137ef21b24b7bdfdb8b02fdefe9 100644 --- a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets +++ b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from './LogUtil.ets' import {MediaLibraryAccess} from '../access/MediaLibraryAccess.ets'; import fileio from '@ohos.fileio'; @@ -42,15 +43,10 @@ export class OperationUtils { var dir = context.filesDir // 2、生成本地文件名 var time = new Date().getTime() - var imagePath = dir + "/" + time.toString().substr(10) + "_note"+ numId + ".jpg" + var imagePath = dir + "/" + time.toString().substr(5) + "_note" + numId + ".jpg" // 3、拷贝 - fileio.copyFile(fd, imagePath).then(() => { - LogUtil.info(TAG, "[save]copyFile successfully") - }).catch((err) => { - LogUtil.info(TAG, "[save]copyFile failed : " + err) - }); + await fileio.copyFile(fd, imagePath) // 4、关闭安fd,Asset - fileAsset.close(fd); await MediaLibraryAccess.closeAsset(fd, fileAsset); } catch (error) { LogUtil.info(TAG, "create error: " + error); diff --git a/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets index bedecf33a4f5192d08b618a12ade6d9b547d0479..736ae5227eb29e11c1364602cf9e0a4d89dfd9ca 100644 --- a/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -90,18 +90,12 @@ export default { LogUtil.info(TAG, "AppStorage[sysdef] set AllFolderArray and AllNoteArray success") // save continue data - let isContinue = AppStorage.Get('IsContinue'); + let isContinue = AppStorage.Get('IsContinue'); LogUtil.info(TAG, "createRdbStore, isContinue is " + isContinue) - if (isContinue != undefined && isContinue == 1) { - LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue true") - let continueFolder: string = AppStorage.Get('ContinueFolder') + if (isContinue) { let continueNote: string = AppStorage.Get('ContinueNote') let continueSection = AppStorage.Get('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, @@ -155,9 +149,11 @@ export default { AppStorage.SetOrCreate('Note', noteData) AppStorage.SetOrCreate('Section', continueSection) } else { - LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue false") + LogUtil.info(TAG, "createRdbStore, IsContinue false") AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) - AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes)) + let note = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes) + AppStorage.SetOrCreate('Note', note) + AppStorage.SetOrCreate('ContinueNote', JSON.stringify(note.toNoteObject())) AppStorage.SetOrCreate('Section', 3) } AppStorage.SetOrCreate('DBQueryFinished', 1) @@ -223,17 +219,12 @@ export default { LogUtil.info(TAG, "AppStorage[query] set AllFolderArray and AllNoteArray success") // 迁移 - let isContinue = AppStorage.Get('IsContinue'); + let isContinue = AppStorage.Get('IsContinue'); LogUtil.info(TAG, "initAppStorage, isContinue is " + isContinue) - if (isContinue != undefined && isContinue == 1) { - let continueFolder: string = AppStorage.Get('ContinueFolder') + if (isContinue) { let continueNote: string = AppStorage.Get('ContinueNote') let continueSection = AppStorage.Get('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, @@ -289,7 +280,9 @@ export default { } else { LogUtil.info(TAG, "RdbStoreUtil initAppStorage, IsContinue false") AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) - AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes)) + let note = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes) + AppStorage.SetOrCreate('Note', note) + AppStorage.SetOrCreate('ContinueNote', JSON.stringify(note.toNoteObject())) AppStorage.SetOrCreate('Section', 3) } AppStorage.SetOrCreate('DBQueryFinished', 1) diff --git a/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets b/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets index 27dd60f3a18e5fc6f71630e9fdb323cd137ba718..4443def7d3ae1133c9b4d38fdb2ecabed574a2d9 100644 --- a/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/utils/src/main/ets/default/constants/StyleConstants.ets b/common/utils/src/main/ets/default/constants/StyleConstants.ets index 809fa78d8250cedb30bc2645d30c5da8a76899b2..863f41780e98196ff63aa0b830a4d4e84f315a7b 100644 --- a/common/utils/src/main/ets/default/constants/StyleConstants.ets +++ b/common/utils/src/main/ets/default/constants/StyleConstants.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/NoteBaseData.ets b/common/utils/src/main/ets/default/model/NoteBaseData.ets index 92aa8764eb29f1661ba39139599b22c8c111de1a..c887364e7a0e42eb346433c1918d601fb3a57b22 100644 --- a/common/utils/src/main/ets/default/model/NoteBaseData.ets +++ b/common/utils/src/main/ets/default/model/NoteBaseData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets index 4a42fd075fab8f3f8f8ddd114e56a07395b55dac..f4723ae8b996bfab686dc3de7df9ee970261b92e 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets index b89c5efaab620aed81e84ad8232d65afbf8eb7bd..191ea274962ecf86a1edf77c6a98b1b8f699687f 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets index e3fb9b5d431d467e3c09223da57903bdac34d95d..1801997e9af8e4db033c52184c8e05b326a97701 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets index ff646decea5956276ec3fafee20f6d0ef5649af7..d65c6c5941bc2e0f2334b5123fa2ad0f738aa5c2 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets index 22c3921db89ef246d276722e93b5d6994414cb56..92e6d1b7ecf8104e0b7f5d5240bc5da7443d5874 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -114,7 +114,7 @@ export default { "title": "数学公式", "uuid": "note1_uuid", "folder_uuid": SysDefFolderUuid.UnClassified, - "content_text": '好好学习,天天向上


', + "content_text": '

好好学习,天天向上



', "content_img": "/res/shuxue.png", "note_type": NoteType.SysDef, "is_top": Top.Yes, @@ -146,7 +146,7 @@ export default { "title": "旅游心得", "uuid": "note3_uuid", "folder_uuid": SysDefFolderUuid.Work, - "content_text": '旅游心得


', + "content_text": '

旅游心得



', "content_img": "/res/lvyou.png", "note_type": NoteType.SysDef, "is_top": Top.No, @@ -162,7 +162,7 @@ export default { "title": "蛋糕做法", "uuid": "note4_uuid", "folder_uuid": SysDefFolderUuid.Life, - "content_text": '蛋糕做法


', + "content_text": '

蛋糕做法



', "content_img": "/res/cake.png", "note_type": NoteType.CusDef, "is_top": Top.No, diff --git a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets index 44d3c91503d08c80f02871f99fae28e9bc6c9639..d855f85c6b89d36449149df1c962b6a302bb7d7d 100644 --- a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets +++ b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -42,7 +42,7 @@ export class SearchModel { } let searchData: NoteData[] = []; noteDataArray.forEach((noteData) => { - if (noteData.content_text.replace(/<[^>]+>/g,"").toLowerCase().indexOf(query.toLowerCase()) != -1 + if (decodeURI(noteData.content_text).replace(/<[^>]+>/g,"").toLowerCase().indexOf(query.toLowerCase()) != -1 || noteData.title.toLowerCase().indexOf(query.toLowerCase()) != -1) { LogUtil.info(TAG, "uuid " + noteData.uuid) searchData.push(noteData); diff --git a/product/pc/src/main/ets/MainAbility/app.ets b/product/pc/src/main/ets/MainAbility/app.ets index 0f7643026af7575807ee0a7aa6e9dfffee64819f..5f980b7d7a09738f854f8f6eaee79ec9a5aad06a 100644 --- a/product/pc/src/main/ets/MainAbility/app.ets +++ b/product/pc/src/main/ets/MainAbility/app.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' const TAG = "app" diff --git a/product/pc/src/main/ets/MainAbility/pages/index.ets b/product/pc/src/main/ets/MainAbility/pages/index.ets index 63827718107518a838ab95454a9e69ffa1f9a41e..3b95ec9d50af1be1ac7a3b7d6f25e3e29c03420d 100644 --- a/product/pc/src/main/ets/MainAbility/pages/index.ets +++ b/product/pc/src/main/ets/MainAbility/pages/index.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + @Entry @Component struct Index { diff --git a/product/pc/src/main/resources/base/element/color.json b/product/pc/src/main/resources/base/element/color.json index 6e15ec2ea3f55bb0cd8814b91854e8a8d02f7ddf..02771c324f3a1fff11a4b2d89e0e6843427fe282 100644 --- a/product/pc/src/main/resources/base/element/color.json +++ b/product/pc/src/main/resources/base/element/color.json @@ -75,6 +75,110 @@ { "name": "notelist_bgcolor_000000", "value": "#000000" + }, + { + "name": "New_folder_input_box_color", + "value": "#ffffff" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ 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 index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/pc/src/main/resources/base/element/string.json +++ b/product/pc/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/pc/src/main/resources/en_US/element/string.json b/product/pc/src/main/resources/en_US/element/string.json index a7618c3e9a3b813e6e9a55e2fd463012cfae0a6d..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/pc/src/main/resources/en_US/element/string.json +++ b/product/pc/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/pc/src/main/resources/zh_CN/element/string.json b/product/pc/src/main/resources/zh_CN/element/string.json index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/pc/src/main/resources/zh_CN/element/string.json +++ b/product/pc/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/phone/src/main/config.json b/product/phone/src/main/config.json index de43749897f58de6658f4ccb0b04d86519ca5aa2..0f113fa159ed8cffe807a749de03d424fe65fc4f 100644 --- a/product/phone/src/main/config.json +++ b/product/phone/src/main/config.json @@ -59,7 +59,7 @@ }, "pages": [ "pages/MyNoteHome", - "pages/NoteHome" + "pages/NoteHomePortrait" ], "name": "MainAbility", "window": { diff --git a/product/phone/src/main/ets/MainAbility/MainAbility.ts b/product/phone/src/main/ets/MainAbility/MainAbility.ts index ef95f8f69536dc29e49b92076b120fcf0c49edae..7052fc1befcc371e2e193a276fc00e678a0c6141 100644 --- a/product/phone/src/main/ets/MainAbility/MainAbility.ts +++ b/product/phone/src/main/ets/MainAbility/MainAbility.ts @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,36 @@ import {WebViewUtil} from './WebViewUtil.ets' import fileio from '@ohos.fileio' export default class MainAbility extends Ability { + private Tag = "Phone_Note_MainAbility" + onCreate(want, launchParam) { - console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason) + console.info(this.Tag + " onCreate, launchReason is " + launchParam.launchReason) + // 折叠状态 + AppStorage.SetOrCreate('Expand', false) + AppStorage.SetOrCreate('Choose', false) if (launchParam.launchReason == 3) { // 获取对端的迁移数据 - let continueFolder: string = want.parameters["ContinueFolder"] let continueNote: string = want.parameters["ContinueNote"] let continueSection: number = want.parameters["ContinueSection"] - // 迁移数据存入AppStorage - AppStorage.SetOrCreate('ContinueFolder', continueFolder) + console.info(this.Tag + " continueSection : " + continueSection) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', continueSection) + // 折叠状态 + let continueExpand: boolean = want.parameters["ContinueExpand"] + let continueChoose: boolean = want.parameters["ContinueChoose"] + console.info(this.Tag + " continueExpand : " + continueExpand + " , continueChoose : " + continueChoose) + AppStorage.SetOrCreate('Expand', continueExpand) + AppStorage.SetOrCreate('Choose', continueChoose) // 设置迁移标记 - AppStorage.SetOrCreate('IsContinue', 1) + AppStorage.SetOrCreate('IsContinue', true) + + // 来自平板的迁移 + if (continueExpand == undefined && continueChoose == undefined) { + console.info(this.Tag + " from tablet") + AppStorage.SetOrCreate('Choose', true) + AppStorage.SetOrCreate('ContinueChoose', true) + } + this.context.restoreWindowStage(null) } AppStorage.SetOrCreate('openPhoto', 0) @@ -39,32 +56,32 @@ export default class MainAbility extends Ability { } onDestroy() { - console.log("MainAbility onDestroy") + console.info(this.Tag + " onDestroy") } onWindowStageCreate(windowStage) { - console.log("MainAbility onWindowStageCreate") + console.info(this.Tag + " onWindowStageCreate") windowStage.setUIContent(this.context, "pages/MyNoteHome", null) } onWindowStageDestroy() { - console.log("MainAbility onWindowStageDestroy") + console.info(this.Tag + " onWindowStageDestroy") } onForeground() { - console.log("MainAbility onForeground") + console.info(this.Tag + " onForeground") } onBackground() { - console.log("MainAbility onBackground") + console.info(this.Tag + " onBackground") let controllerShow = WebViewUtil.getWebController() if (controllerShow == undefined || controllerShow == null) { console.info("MainAbility onBackground, controllerShow is error") } - console.log("MainAbility controllerShow : " + controllerShow) + console.info(this.Tag + " controllerShow : " + controllerShow) controllerShow.runJavaScript({ script: "get_html_content()" }) - console.log("MainAbility controllerShow end") + console.info(this.Tag + " controllerShow end") } } \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/WebViewUtil.ets b/product/phone/src/main/ets/MainAbility/WebViewUtil.ets index 44ed6a2715c9a45cefd162633968411cc79da1ad..f1fa1c7b4d29702a1dda1e7bff010340578f4689 100644 --- a/product/phone/src/main/ets/MainAbility/WebViewUtil.ets +++ b/product/phone/src/main/ets/MainAbility/WebViewUtil.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/phone/src/main/ets/MainAbility/app.ets b/product/phone/src/main/ets/MainAbility/app.ets index 1e6c8b3d40694f57a81b67eca79af24449cdb756..00231a43a909b6c4cb48c86f3980db488ebaabc9 100644 --- a/product/phone/src/main/ets/MainAbility/app.ets +++ b/product/phone/src/main/ets/MainAbility/app.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets index 1012e8b0a0da4fdbe34df1124a2f3920f548538d..ceaaee4b88c2bba09de3b9aa3e8a9ac68db73133 100644 --- a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets +++ b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,6 @@ import fileio from '@ohos.fileio' import bundle from '@ohos.bundle' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -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' @@ -32,11 +31,7 @@ export struct MyNoteHomeComp { build() { Flex() { if (this.dBQueryFinished == 1) { - if (this.portraitModel == true) { - NoteHomePortraitComp() - } else { - NoteHomeComp() - } + NoteHomePortraitComp() } } .width('100%').height('100%') diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets deleted file mode 100644 index 54175a316b2b68a780caacd96c1eade25a1f25ec..0000000000000000000000000000000000000000 --- a/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets +++ /dev/null @@ -1,109 +0,0 @@ -/** - * 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) - .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($r("app.color.notecontent_color_ffffff")) - .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight) - .height(StyleConstants.PERCENTAGE_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 index 7fef71723d544389c550d04136cea1b72d3931b2..44cd0f61960acb41e30b0e99dfc216183f7388d0 100644 --- a/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets +++ b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,8 +41,11 @@ export struct NoteHomePortraitComp { @Provide('LastSectionStatus') lastSectionStatus: number = 1; // 记录分栏上一次的状态 @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 - @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 - @Provide('ChooseNote') chooseNote: boolean = false // 是否选择笔记进行打开 + + // 分栏状态 + @Provide('ExpandStatus') expandStatus: boolean = AppStorage.Get('Expand') // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = AppStorage.Get('Choose') // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json index 6e6bbdac32de78757f85ad89f172343d2d82fa5a..23674b867de2c4512eae37f886b611eb44eb0e07 100644 --- a/product/phone/src/main/resources/base/element/color.json +++ b/product/phone/src/main/resources/base/element/color.json @@ -91,6 +91,110 @@ { "name": "font_stylecolor_AD182431", "value": "#AD182431" + }, + { + "name": "New_folder_input_box_color", + "value": "#FFFFFF" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ 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 index acd4635b4360dc8df47911ab5f7eb9121f4642fa..522035231224349594b5ed2dec6cf5cc9640823d 100644 --- a/product/phone/src/main/resources/base/element/string.json +++ b/product/phone/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/phone/src/main/resources/en_US/element/string.json b/product/phone/src/main/resources/en_US/element/string.json index acbe6f3dab36de535c5933ec661d0e1f82b11967..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/phone/src/main/resources/en_US/element/string.json +++ b/product/phone/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "Name" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/phone/src/main/resources/rawfile/editor_style.css b/product/phone/src/main/resources/rawfile/editor_style.css index 9f7121f75abee2a52f66cab923ae7bcf720dbfd0..abf650a03b41d3e337c45387269afacb1db9f6c7 100644 --- a/product/phone/src/main/resources/rawfile/editor_style.css +++ b/product/phone/src/main/resources/rawfile/editor_style.css @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/product/phone/src/main/resources/rawfile/rich_editor.js b/product/phone/src/main/resources/rawfile/rich_editor.js index 53b746d3cac6970b706297d04d31f5821dadcab5..c30a8ddf69186fd993eb193849f2cfad34f71349 100644 --- a/product/phone/src/main/resources/rawfile/rich_editor.js +++ b/product/phone/src/main/resources/rawfile/rich_editor.js @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,19 +25,6 @@ RICH_EDITOR.getHtml = function() { return RICH_EDITOR.editor.innerHTML; } -RICH_EDITOR.getText = function() { - console.log(RICH_EDITOR.editor.innerText); - return RICH_EDITOR.editor.innerText; -} - -RICH_EDITOR.setBaseTextColor = function(color) { - RICH_EDITOR.editor.style.color = color; -} - -RICH_EDITOR.setBaseFontSize = function(size) { - RICH_EDITOR.editor.style.fontSize = size; -} - RICH_EDITOR.undo = function() { document.execCommand('undo', false, null); } @@ -174,13 +161,6 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); } -RICH_EDITOR.setTextBackgroundColor = function(color) { - RICH_EDITOR.restorerange(); - document.execCommand("styleWithCSS", null, true); - document.execCommand('hiliteColor', false, color); - document.execCommand("styleWithCSS", null, false); -} - RICH_EDITOR.setFontSize = function(fontSize){ document.execCommand("fontSize", false, fontSize); } @@ -192,10 +172,6 @@ RICH_EDITOR.execFontSize = function (size, unit) { fontElements.style.fontSize = size + 'px' }; -RICH_EDITOR.setHeading = function(heading) { - document.execCommand('formatBlock', false, ''); -} - RICH_EDITOR.setIndent = function() { document.execCommand('indent', false, null); } @@ -216,12 +192,7 @@ RICH_EDITOR.setJustifyRight = function() { document.execCommand('justifyRight', false, null); } -RICH_EDITOR.setBlockquote = function() { - document.execCommand('formatBlock', false, '
'); -} - RICH_EDITOR.insertImage = function(url) { - console.log("js,url:" + url) var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false) @@ -291,17 +262,17 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ } function get_html_content() { - console.log('hhh Ark WebComponent'); + console.log('get_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtml(htmlString) - console.log('hhh objName.test result:' + str); + console.log('get_html_content end'); } function save_html_content() { - console.log('hhh Ark WebComponent'); + console.log('save_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtmlSave(htmlString) - console.log('hhh objName.test result:' + str); + console.log('save_html_content end'); } function scheduled_save_content() { diff --git a/product/phone/src/main/resources/zh_CN/element/string.json b/product/phone/src/main/resources/zh_CN/element/string.json index fb355baaa36d57d35d46cb9b79df976621b604ad..d8cc1649a2b74453ef6c1a37bb5f953b6cf99d66 100644 --- a/product/phone/src/main/resources/zh_CN/element/string.json +++ b/product/phone/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/tablet/src/main/ets/MainAbility/MainAbility.ts b/product/tablet/src/main/ets/MainAbility/MainAbility.ts index ef95f8f69536dc29e49b92076b120fcf0c49edae..c39b761208fee1d01880d6e120399de86422ae09 100644 --- a/product/tablet/src/main/ets/MainAbility/MainAbility.ts +++ b/product/tablet/src/main/ets/MainAbility/MainAbility.ts @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,24 @@ import {WebViewUtil} from './WebViewUtil.ets' import fileio from '@ohos.fileio' export default class MainAbility extends Ability { + private Tag = "Tablet_Note_MainAbility" + onCreate(want, launchParam) { - console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason) + console.info(this.Tag + " 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"] - // 迁移数据存入AppStorage - AppStorage.SetOrCreate('ContinueFolder', continueFolder) + console.info(this.Tag + " continueSection : " + continueSection) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', continueSection) // 设置迁移标记 - AppStorage.SetOrCreate('IsContinue', 1) + AppStorage.SetOrCreate('IsContinue', true) + + // 来自手机的迁移 + let isChoose: boolean = want.parameters["ContinueChoose"] + console.info(this.Tag + " from phone, isChoose : " + isChoose) + AppStorage.SetOrCreate('IsChoose', isChoose) this.context.restoreWindowStage(null) } AppStorage.SetOrCreate('openPhoto', 0) @@ -39,32 +44,32 @@ export default class MainAbility extends Ability { } onDestroy() { - console.log("MainAbility onDestroy") + console.info(this.Tag + " onDestroy") } onWindowStageCreate(windowStage) { - console.log("MainAbility onWindowStageCreate") + console.info(this.Tag + " onWindowStageCreate") windowStage.setUIContent(this.context, "pages/MyNoteHome", null) } onWindowStageDestroy() { - console.log("MainAbility onWindowStageDestroy") + console.info(this.Tag + " onWindowStageDestroy") } onForeground() { - console.log("MainAbility onForeground") + console.info(this.Tag + " onForeground") } onBackground() { - console.log("MainAbility onBackground") + console.info(this.Tag + " onBackground") let controllerShow = WebViewUtil.getWebController() if (controllerShow == undefined || controllerShow == null) { console.info("MainAbility onBackground, controllerShow is error") } - console.log("MainAbility controllerShow : " + controllerShow) + console.info(this.Tag + " controllerShow : " + controllerShow) controllerShow.runJavaScript({ script: "get_html_content()" }) - console.log("MainAbility controllerShow end") + console.info(this.Tag + " controllerShow end") } } \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets b/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets index 44ed6a2715c9a45cefd162633968411cc79da1ad..f1fa1c7b4d29702a1dda1e7bff010340578f4689 100644 --- a/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets +++ b/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/tablet/src/main/ets/MainAbility/app.ets b/product/tablet/src/main/ets/MainAbility/app.ets index 1e6c8b3d40694f57a81b67eca79af24449cdb756..00231a43a909b6c4cb48c86f3980db488ebaabc9 100644 --- a/product/tablet/src/main/ets/MainAbility/app.ets +++ b/product/tablet/src/main/ets/MainAbility/app.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets index 874c354b9448aa8a44c5407a11f5d1511a3ba66f..6814328031cc98d8fbf4820d90682654b8418636 100644 --- a/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,7 +17,6 @@ import fileio from '@ohos.fileio' import bundle from '@ohos.bundle' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' 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' @@ -32,11 +31,7 @@ export struct MyNoteHomeComp { build() { Row() { if (this.dBQueryFinished == 1) { - if (this.portraitModel == true) { - NoteHomePortraitComp() - } else { NoteHomeComp() - } } } .width('100%') diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets index 7251496d49593148ae99a23b854fd3e1d46a14b9..7c45829657159048f4e7796cc8c3a986b29bf65f 100644 --- a/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -116,6 +116,17 @@ export struct NoteHomeComp { LogUtil.info(this.TAG, "aboutToAppear") this.narrowWinListener.on('change', this.onWinSizeChange.bind(this)) this.sectionStatus = this.narrowWinListener.matches ? 2 : 3 + let isContinue = AppStorage.Get('IsContinue') + LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue) + if (isContinue) { + this.sectionStatus = AppStorage.Get('Section') + } + // continue from phone + let isChoose = AppStorage.Get('IsChoose') + LogUtil.info(this.TAG, "aboutToAppear, isChoose : " + isChoose) + if (isChoose) { + this.sectionStatus = 1 + } } aboutToDisappear(): void{ diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets deleted file mode 100644 index 5968cae3fbfb5234ebf1bbbfbb18427ece55d05a..0000000000000000000000000000000000000000 --- a/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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/resources/base/element/color.json b/product/tablet/src/main/resources/base/element/color.json index 6e6bbdac32de78757f85ad89f172343d2d82fa5a..23674b867de2c4512eae37f886b611eb44eb0e07 100644 --- a/product/tablet/src/main/resources/base/element/color.json +++ b/product/tablet/src/main/resources/base/element/color.json @@ -91,6 +91,110 @@ { "name": "font_stylecolor_AD182431", "value": "#AD182431" + }, + { + "name": "New_folder_input_box_color", + "value": "#FFFFFF" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ 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 index b27e5711573ec0bac80f8b16c8a07b04653dbee9..8ac010350d924e2ad157cb5c5d0c81a149b6ac48 100644 --- a/product/tablet/src/main/resources/base/element/string.json +++ b/product/tablet/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/tablet/src/main/resources/en_US/element/string.json b/product/tablet/src/main/resources/en_US/element/string.json index a7618c3e9a3b813e6e9a55e2fd463012cfae0a6d..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/tablet/src/main/resources/en_US/element/string.json +++ b/product/tablet/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/tablet/src/main/resources/rawfile/editor_style.css b/product/tablet/src/main/resources/rawfile/editor_style.css index dfb83e11437ebf4eff807f79d47cb0d3ea76c7f9..abf650a03b41d3e337c45387269afacb1db9f6c7 100644 --- a/product/tablet/src/main/resources/rawfile/editor_style.css +++ b/product/tablet/src/main/resources/rawfile/editor_style.css @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,7 @@ html { height: 15%; font-family: sans-serif; --webkit-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; } body { diff --git a/product/tablet/src/main/resources/rawfile/rich_editor.js b/product/tablet/src/main/resources/rawfile/rich_editor.js index 53b746d3cac6970b706297d04d31f5821dadcab5..c30a8ddf69186fd993eb193849f2cfad34f71349 100644 --- a/product/tablet/src/main/resources/rawfile/rich_editor.js +++ b/product/tablet/src/main/resources/rawfile/rich_editor.js @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,19 +25,6 @@ RICH_EDITOR.getHtml = function() { return RICH_EDITOR.editor.innerHTML; } -RICH_EDITOR.getText = function() { - console.log(RICH_EDITOR.editor.innerText); - return RICH_EDITOR.editor.innerText; -} - -RICH_EDITOR.setBaseTextColor = function(color) { - RICH_EDITOR.editor.style.color = color; -} - -RICH_EDITOR.setBaseFontSize = function(size) { - RICH_EDITOR.editor.style.fontSize = size; -} - RICH_EDITOR.undo = function() { document.execCommand('undo', false, null); } @@ -174,13 +161,6 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); } -RICH_EDITOR.setTextBackgroundColor = function(color) { - RICH_EDITOR.restorerange(); - document.execCommand("styleWithCSS", null, true); - document.execCommand('hiliteColor', false, color); - document.execCommand("styleWithCSS", null, false); -} - RICH_EDITOR.setFontSize = function(fontSize){ document.execCommand("fontSize", false, fontSize); } @@ -192,10 +172,6 @@ RICH_EDITOR.execFontSize = function (size, unit) { fontElements.style.fontSize = size + 'px' }; -RICH_EDITOR.setHeading = function(heading) { - document.execCommand('formatBlock', false, ''); -} - RICH_EDITOR.setIndent = function() { document.execCommand('indent', false, null); } @@ -216,12 +192,7 @@ RICH_EDITOR.setJustifyRight = function() { document.execCommand('justifyRight', false, null); } -RICH_EDITOR.setBlockquote = function() { - document.execCommand('formatBlock', false, '
'); -} - RICH_EDITOR.insertImage = function(url) { - console.log("js,url:" + url) var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false) @@ -291,17 +262,17 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ } function get_html_content() { - console.log('hhh Ark WebComponent'); + console.log('get_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtml(htmlString) - console.log('hhh objName.test result:' + str); + console.log('get_html_content end'); } function save_html_content() { - console.log('hhh Ark WebComponent'); + console.log('save_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtmlSave(htmlString) - console.log('hhh objName.test result:' + str); + console.log('save_html_content end'); } function scheduled_save_content() { diff --git a/product/tablet/src/main/resources/zh_CN/element/string.json b/product/tablet/src/main/resources/zh_CN/element/string.json index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/tablet/src/main/resources/zh_CN/element/string.json +++ b/product/tablet/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?"