!13 note 蓝区代码更新

Merge pull request !13 from jiangchengfeixue/master
This commit is contained in:
openharmony_ci
2022-03-22 14:28:24 +00:00
committed by Gitee
55 changed files with 654 additions and 738 deletions
@@ -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 })
}
@@ -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<string>('ContinueFolder', continueFolder)
AppStorage.SetOrCreate<string>('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<string>('ContinueFolder', continueFolder)
AppStorage.SetOrCreate<string>('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")
}
})
}
@@ -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<number>('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<number>('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<string>('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<number>('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<number>('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<number>('openPhoto', 1)
await globalThis.noteContext.startAbilityForResult({
parameters: { uri: "singleselect" },
bundleName: "com.ohos.photos",
abilityName: "com.ohos.photos.MainAbility",
})
.then(v => {
AppStorage.SetOrCreate<number>('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<string>('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[] = []
@@ -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<string>('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<string>('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)
@@ -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<string>('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<string>('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)
@@ -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';
@@ -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
@@ -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)
}
}
@@ -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'
@@ -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<string> {
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);
}
@@ -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
@@ -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
@@ -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
}
@@ -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);
@@ -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<boolean>('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<string>('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<boolean>('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<string>('ContinueNote', JSON.stringify(note.toNoteObject()))
AppStorage.SetOrCreate('Section', 3)
}
AppStorage.SetOrCreate('DBQueryFinished', 1)
@@ -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.
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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": '好好学习,天天向上<div style="text-align:center;"><img src="./shuxue.png" height="700"/></div><br><br>',
"content_text": '<p>好好学习,天天向上</p><div style="text-align:center;"><img src="./shuxue.png" height="700" style="border-radius:10px"/></div><br><br>',
"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": '旅游心得<div style="text-align:center;"><img src="./lvyou.png" height="700"/></div><br><br>',
"content_text": '<p>旅游心得</p><div style="text-align:center;"><img src="./lvyou.png" height="700" style="border-radius:10px"/></div><br><br>',
"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": '蛋糕做法<div style="text-align:center;"><img src="./cake.png" height="700"/></div><br><br>',
"content_text": '<p>蛋糕做法</p><div style="text-align:center;"><img src="./cake.png" height="600" style="border-radius:10px"/></div><br><br>',
"content_img": "/res/cake.png",
"note_type": NoteType.CusDef,
"is_top": Top.No,
@@ -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);
+3 -2
View File
@@ -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"
@@ -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 {
@@ -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"
}
]
}
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
@@ -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?"
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
+1 -1
View File
@@ -59,7 +59,7 @@
},
"pages": [
"pages/MyNoteHome",
"pages/NoteHome"
"pages/NoteHomePortrait"
],
"name": "MainAbility",
"window": {
@@ -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<boolean>('Expand', false)
AppStorage.SetOrCreate<boolean>('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<string>('ContinueFolder', continueFolder)
console.info(this.Tag + " continueSection : " + continueSection)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', continueSection)
// 折叠状态
let continueExpand: boolean = want.parameters["ContinueExpand"]
let continueChoose: boolean = want.parameters["ContinueChoose"]
console.info(this.Tag + " continueExpand : " + continueExpand + " , continueChoose : " + continueChoose)
AppStorage.SetOrCreate<boolean>('Expand', continueExpand)
AppStorage.SetOrCreate<boolean>('Choose', continueChoose)
// 设置迁移标记
AppStorage.SetOrCreate<number>('IsContinue', 1)
AppStorage.SetOrCreate<boolean>('IsContinue', true)
// 来自平板的迁移
if (continueExpand == undefined && continueChoose == undefined) {
console.info(this.Tag + " from tablet")
AppStorage.SetOrCreate<boolean>('Choose', true)
AppStorage.SetOrCreate('ContinueChoose', true)
}
this.context.restoreWindowStage(null)
}
AppStorage.SetOrCreate<number>('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")
}
}
@@ -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.
@@ -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.
@@ -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%')
@@ -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")
}
}
@@ -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<boolean>('Expand') // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = AppStorage.Get<boolean>('Choose') // 是否选择笔记进行打开
@Provide('Search') search: boolean = false // 是否处于搜索状态
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
@@ -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"
}
]
}
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
@@ -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?"
@@ -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
@@ -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, '<h'+heading+'>');
}
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, '<blockquote>');
}
RICH_EDITOR.insertImage = function(url) {
console.log("js,url:" + url)
var html = '<br></br><img src="' + url + '" alt="picvision" style="margin:0px auto;width:90%;display:table-cell;vertical-align:middle;border-radius:10px;max-width:90%" /><br></br>';
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() {
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
@@ -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<string>('ContinueFolder', continueFolder)
console.info(this.Tag + " continueSection : " + continueSection)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', continueSection)
// 设置迁移标记
AppStorage.SetOrCreate<number>('IsContinue', 1)
AppStorage.SetOrCreate<boolean>('IsContinue', true)
// 来自手机的迁移
let isChoose: boolean = want.parameters["ContinueChoose"]
console.info(this.Tag + " from phone, isChoose : " + isChoose)
AppStorage.SetOrCreate<boolean>('IsChoose', isChoose)
this.context.restoreWindowStage(null)
}
AppStorage.SetOrCreate<number>('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")
}
}
@@ -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.
@@ -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.
@@ -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%')
@@ -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<boolean>('IsContinue')
LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue)
if (isContinue) {
this.sectionStatus = AppStorage.Get('Section')
}
// continue from phone
let isChoose = AppStorage.Get<boolean>('IsChoose')
LogUtil.info(this.TAG, "aboutToAppear, isChoose : " + isChoose)
if (isChoose) {
this.sectionStatus = 1
}
}
aboutToDisappear(): void{
@@ -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")
}
}
@@ -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"
}
]
}
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
@@ -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?"
@@ -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 {
@@ -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, '<h'+heading+'>');
}
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, '<blockquote>');
}
RICH_EDITOR.insertImage = function(url) {
console.log("js,url:" + url)
var html = '<br></br><img src="' + url + '" alt="picvision" style="margin:0px auto;width:90%;display:table-cell;vertical-align:middle;border-radius:10px;max-width:90%" /><br></br>';
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() {
@@ -60,10 +60,6 @@
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"