!12 代码上传

Merge pull request !12 from jiangchengfeixue/OpenHarmony-3.1-Release
This commit is contained in:
openharmony_ci
2022-03-21 06:16:26 +00:00
committed by Gitee
53 changed files with 1982 additions and 689 deletions
+2
View File
@@ -25,6 +25,8 @@
<!--policyitem type="compatibility" name="GPL-2.0+" path="abc/.*" desc="Process that runs independently, invoked by the X process."/-->
<!--policyitem type="license" name="LGPL" path="abc/.*" desc="Dynamically linked by module X"/-->
<!--policyitem type="copyright" name="xxx" path="abc/.*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed by X Company"/-->
<policyitem type="copyright" name="Copyright 2015 the original author or authors." path="gradlew" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="file generated by development tool"/>
<policyitem type="copyright" name="Copyright 2015 the original author or authors." path="gradlew.bat" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="file generated by development tool"/>
</policy>
</policylist>
<filefilterlist>
@@ -20,7 +20,9 @@ import {SysDefFolderUuid, DeleteFileType, FolderType} from '../../../../../../co
import GlobalResourceManager from '../../../../../../common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
const TAG = "CusDialogComp"
@CustomDialog
export struct NewOrEditFolderDialog {
newOrEditFolderDialogCtl: CustomDialogController
@@ -72,6 +74,9 @@ export struct NewOrEditFolderDialog {
.margin({ left: 64 })
.fontColor("#FA2A2D")
.visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None)
Divider().height(1)
.margin({ left: 64, right: 24 })
.color($r("app.color.divider_color_182431"))
// button group
Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) {
Text($r("app.string.cancel"))
@@ -571,7 +576,7 @@ export struct EditContentDialog {
this.inSetValue = value
this.fontSize = value + 20
this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')")
console.info('value:' + value + 'mode:' + mode.toString())
LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString())
})
.width('88%')
Image($r('app.media.font_large'))
@@ -682,69 +687,159 @@ export struct EditContentDialogPortrait {
})
}
.height(48)
.padding({ left: 24, right: 24 })
Row({ space: 34 }) {
Image($r('app.media.action_bold')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setBold()")
})
Image($r('app.media.format_italic')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setItalic()")
})
Image($r('app.media.underline')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setUnderline()")
})
Image($r('app.media.right_justify')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyRight()")
})
Image($r('app.media.mid_justify')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyCenter()")
})
Image($r('app.media.left_justify')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyLeft()")
})
Row({ space: 16 }) {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.action_bold'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setBold()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.format_italic'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setItalic()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.underline'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setUnderline()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.right_justify'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyRight()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.mid_justify'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyCenter()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.left_justify'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setJustifyLeft()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
}
.height(48)
Divider().vertical(false).color($r("app.color.divider_color_e4e4e4"))
Row({ space: 34 }) {
Row({ space: 16 }) {
Image($r('app.media.suojin')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setIndent()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.suojin'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setIndent()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Image($r('app.media.suojin_back')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setOutdent()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.suojin_back'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setOutdent()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Image($r("app.media.format_menulist_number")).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setNumbers()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r("app.media.format_menulist_number"))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setNumbers()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Image($r("app.media.format_menulist_alphabet")).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setABC()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r("app.media.format_menulist_alphabet"))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setABC()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Image($r('app.media.format_menubullte2')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setBullets()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.format_menubullte2'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setBullets()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Image($r('app.media.format_menubullte1')).height(24).width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setSquare()")
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.format_menubullte1'))
.height(24)
.width(24)
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setSquare()")
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
}
.height(48)
@@ -765,6 +860,7 @@ export struct EditContentDialogPortrait {
}
}
.height(48)
.padding({ left: 24, right: 24 })
Divider().vertical(false).color($r("app.color.divider_color_e4e4e4"))
@@ -786,7 +882,7 @@ export struct EditContentDialogPortrait {
this.inSetValue = value
this.fontSize = value + 20
this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')")
console.info('value:' + value + 'mode:' + mode.toString())
LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString())
})
.width('79%')
Image($r('app.media.font_large')).height(24).width(24).margin({ top: 7 })
@@ -794,11 +890,11 @@ export struct EditContentDialogPortrait {
.alignItems(VerticalAlign.Top)
.padding({ top: 5 })
.height(72)
.padding({ left: 24, right: 24 })
}
.width(360)
.height(266)
.backgroundColor($r("app.color.color_ffffff"))
.borderRadius(36)
.padding({ left: 24, right: 24 })
}
}
@@ -21,7 +21,7 @@ import StyleConstants from '../../../../../../common/utils/src/main/ets/default/
import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
// Folder list component
@Component
@@ -33,45 +33,40 @@ export struct FolderListComp {
TAG = "FolderListComp"
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Column() {
Column() {
Image($r("app.media.suojin"))
.height(24)
.width(24)
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// 迁移
console.log("FolderListComp, set continue section")
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("FolderListComp, set continue section success")
}
})
}.alignItems(HorizontalAlign.Start)
.width("100%")
.margin({ top: 28 })
.padding({ left: 24 })
Image($r("app.media.suojin"))
.height(24)
.width(24)
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// 迁移
LogUtil.info(this.TAG, "FolderListComp, set continue section")
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(this.TAG, "FolderListComp, set continue section success")
}
})
}.alignItems(HorizontalAlign.Start)
.width("100%")
.margin({ top: 28 })
.padding({ left: 24 })
NoteAndCreateComp()
NoteAndCreateComp()
// center
Column() {
List() {
ForEach(this.AllFolderArray, (folderItem: FolderData) => {
ListItem() {
if (!FolderUtil.isBottomFixedFolder(folderItem)) {
FolderItemComp({ folderItem: folderItem, controllerShow: this.controllerShow })
}
}
}, folderItem => folderItem.name.toString())
List() {
ForEach(this.AllFolderArray, (folderItem: FolderData) => {
ListItem() {
if (!FolderUtil.isBottomFixedFolder(folderItem)) {
FolderItemComp({ folderItem: folderItem, controllerShow: this.controllerShow })
}
}
}.width('100%')
.padding({ left: 12, right: 12 })
.height(7 * 56) // 列表最多显示7个 每个的高度为56
}
}, folderItem => folderItem.name.toString())
}.width('100%')
.padding({ left: 12, right: 12 })
Blank()
Column() {
FolderItemComp({
folderItem: FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), SysDefFolderUuid.MyFavorites),
@@ -81,10 +76,12 @@ export struct FolderListComp {
folderItem: FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), SysDefFolderUuid.RecentDeletes),
controllerShow: this.controllerShow
})
}.margin({ bottom: 48 })
}
.width("100%")
.padding({ left: 12, right: 12 })
}
.padding({ bottom: 48 })
.height("100%")
}
aboutToAppear(): void{
@@ -165,7 +162,7 @@ struct FolderItemComp {
controllerShow: WebController
private isLongPress: boolean = false
TAG = "FolderListComp"
// Folder Edit Dialog
// Folder Edit Dialog
folderEditDialogCtl: CustomDialogController = new CustomDialogController({
builder: NewOrEditFolderDialog({
editFolderUuid: this.folderItem.uuid,
@@ -176,7 +173,7 @@ struct FolderItemComp {
autoCancel: false,
customStyle: true,
})
// Folder Edit Dialog for portrait model
// Folder Edit Dialog for portrait model
folderEditDialogCtlBottom: CustomDialogController = new CustomDialogController({
builder: NewOrEditFolderDialog({
editFolderUuid: this.folderItem.uuid,
@@ -187,7 +184,7 @@ struct FolderItemComp {
autoCancel: false,
customStyle: true,
})
// Folder Edit Callback
// Folder Edit Callback
onEditConfirm(color:string, name:string) {
this.folderItem.color = color
this.folderItem.name = name
@@ -197,21 +194,21 @@ struct FolderItemComp {
predicates_folder.equalTo(FolderTableColumn.Uuid, this.folderItem.uuid)
RdbStoreUtil.update(this.folderItem.toFolderObject(), predicates_folder, null)
}
// Folder Delete Dialog
// Folder Delete Dialog
folderDeleteDialogCtl: CustomDialogController = new CustomDialogController({
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), deleteFileType: DeleteFileType.FolderData }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
// Folder Delete Dialog for portrait model
// Folder Delete Dialog for portrait model
folderDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), deleteFileType: DeleteFileType.FolderData }),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
})
// Folder Delete Callback
// Folder Delete Callback
onDeleteConfirm() {
let currentFolder = FolderUtil.getFolderData(this.AllFolderArray, this.folderItem.uuid)
let index = this.AllFolderArray.indexOf(currentFolder)
@@ -239,24 +236,24 @@ struct FolderItemComp {
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueFolder', continueFolder)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("onDeleteConfirm, set continue folder and note success")
LogUtil.info(this.TAG, "onDeleteConfirm, set continue folder and note success")
}
}
// Folder Create Dialog
// Folder Create Dialog
folderCreateDialogCtl: CustomDialogController = new CustomDialogController({
builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
// Folder Create Dialog for portrait model
// Folder Create Dialog for portrait model
folderCreateDialogCtlBottom: CustomDialogController = new CustomDialogController({
builder: NewOrEditFolderDialog({ confirm: this.onCreateConfirm.bind(this), dialogType: 0 }),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
})
// Folder Create Callback
// Folder Create Callback
onCreateConfirm(color:string, name:string) {
let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
this.AllFolderArray.push(folderData)
@@ -373,7 +370,7 @@ struct FolderItemComp {
AppStorage.SetOrCreate<string>('ContinueFolder', continueFolder)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate('ContinueSection', 3)
console.log("FolderItemComp, set continue folder and note success")
LogUtil.info(this.TAG, "FolderItemComp, set continue folder and note success")
}
})
}
@@ -24,10 +24,14 @@ import FolderUtil from '../../../../../../common/utils/src/main/ets/default/base
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import prompt from '@system.prompt'
import featureAbility from '@ohos.ability.featureAbility'
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import OperationUtils from '../../../../../../common/utils/src/main/ets/default/baseUtil/OperationUtils.ets'
import mediaquery from '@ohos.mediaquery'
const TAG = "NoteContentComp"
var timeId : number
// Note content component
@Component
export struct NoteContentComp {
@@ -44,34 +48,36 @@ export struct NoteContentComp {
private context = getContext(this)
noteContent = {
callbackhtml: (html) => {
LogUtil.info(TAG, 'html content is:' + html)
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
// 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, 'update note success:' + this.selectedNoteData)
LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("callbackhtml, set continue note success")
LogUtil.info(TAG, "callbackhtml, set continue note success")
return "AceString"
},
callbackhtmlSave: (html) => {
LogUtil.info(TAG, 'html content is:' + html)
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
// 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, 'update note success:' + this.selectedNoteData)
LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("callbackhtml, set continue note success")
LogUtil.info(TAG, "callbackhtml, set continue note success")
// 删除空白笔记
if(NoteUtil.deleteEmptyNote(this.selectedNoteData,this.AllNoteArray,this.controllerShow)) {
this.selectedNoteData = this.AllNoteArray[0]
@@ -79,12 +85,29 @@ export struct NoteContentComp {
this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"})
}
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() {
Stack({ alignContent: Alignment.Bottom }) {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap,
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
Column() {
ToolBarComp({ controllerShow: this.controllerShow })
@@ -102,14 +125,13 @@ export struct NoteContentComp {
this.controllerShow.registerJavaScriptProxy({
obj: this.noteContent,
name: "callBackToApp", // html--> name.method
methodList: ["callbackhtml","callbackhtmlSave"],
methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave"],
})
LogUtil.info(TAG, "finish register")
this.controllerShow.refresh()
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
console.log('onPageEnd:' + e.url)
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
// 初次加载为为小屏预览模式
if (this.sectionStatus != 1) {
@@ -131,9 +153,14 @@ export struct NoteContentComp {
this.sectionStatus = 1
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
this.editModel = !this.editModel
// 添加定时器:5s自动保存
timeId = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduled_save_content()" })
}, 5000)
LogUtil.info(TAG, "NoteContentComp, setInterval timeId : " + timeId)
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("NoteContentComp, set continue section success")
LogUtil.info(TAG, "NoteContentComp, set continue section success")
}
})
}
@@ -164,6 +191,7 @@ export struct NoteContentOverViewComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@Consume('EditModel') editModel: boolean
@Consume('SectionStatus') sectionStatus: number
@Consume('RefreshFlag') refreshFlag: number
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }),
alignment: DialogAlignment.Center,
@@ -188,6 +216,10 @@ export struct NoteContentOverViewComp {
}
.onClick(() => {
this.selectedNoteData.folder_uuid = item.uuid
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
})
}, noteItem => noteItem.uuid)
}.listDirection(Axis.Vertical)
@@ -210,7 +242,7 @@ export struct NoteContentOverViewComp {
this.editTitleDialogCtl.open()
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("NoteContentOverViewComp, set continue section success")
LogUtil.info(TAG, "NoteContentComp, set continue section success")
})
}.height(40)
.width(StyleConstants.PERCENTAGE_100)
@@ -218,7 +250,7 @@ export struct NoteContentOverViewComp {
Row() {
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
.fontSize(12)
.padding({ top: 4, bottom: 4 })
.padding({ top: 4, bottom: 4 }).fontColor('#A3A7AD')
Row() {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
.fontSize(12)
@@ -289,7 +321,7 @@ export struct ToolBarComp {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("ToolBarComp, onDeleteConfirm, set continue note success")
LogUtil.info(TAG, "NoteContentOverViewComp, set continue section success")
}
editContentDialogCtl: CustomDialogController = new CustomDialogController({
@@ -300,7 +332,6 @@ export struct ToolBarComp {
})
confirm(excuteJs: string) {
prompt.showToast({ message: excuteJs, duration: 2000 })
this.controllerShow.runJavaScript({ script: excuteJs })
}
@@ -331,15 +362,21 @@ export struct ToolBarComp {
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
}
}
this.editModel = !this.editModel
// 迁移
console.log("ToolBarComp, set continue section")
LogUtil.info(TAG, "ToolBarComp, set continue section")
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("ToolBarComp, set continue section success")
LogUtil.info(TAG, "ToolBarComp, set continue section success")
})
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
}
@@ -371,7 +408,7 @@ export struct ToolBarComp {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("recover, set continue note success")
LogUtil.info(TAG, "recover, set continue note success")
})
}.width(72)
.visibility(this.portraitModel ? Visibility.None : Visibility.Visible)
@@ -399,59 +436,92 @@ export struct ToolBarComp {
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_24 }) {
Image($r('app.media.circle_tick1'))
.height(24)
.width(24)
.onClick(() => {
// 清单
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
})
Image($r('app.media.styles'))
.height(24)
.width(24)
.onClick(() => {
if (this.portraitModel) {
this.editContentDialogCtl.open()
} else {
this.editContentDialogCtl.open()
}
})
Image($r('app.media.picture_white'))
.height(24)
.width(24)
.onClick(() => {
console.info('test select single select!')
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.insertImage()" })
})
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")
prompt.showToast({ message: $r('app.string.empty_note'), duration: 2000 })
}
})
Image($r('app.media.undo'))
.height(24)
.width(24)
.onClick(() => {
Row({ space: StyleConstants.SPACE_6 }) {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.circle_tick1'))
.height(24)
.width(24)
.onClick(() => {
// 清单
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" })
})
Image($r('app.media.todo'))
.height(24)
.width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" })
})
}.width(268)
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.styles'))
.height(24)
.width(24)
.onClick(() => {
if (this.portraitModel) {
this.editContentDialogCtl.open()
} else {
this.editContentDialogCtl.open()
}
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.picture_white')).height(24).width(24)
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
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)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.undo'))
.height(24)
.width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.todo'))
.height(24)
.width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
}.width(274)
} else {
Row({ space: StyleConstants.SPACE_24 }) {
Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') : $r('app.media.favorite_cancel'))
@@ -466,10 +536,11 @@ export struct ToolBarComp {
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) {
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("ToolBarComp, set continue note success")
LogUtil.info(TAG, "ToolBarComp, set continue note success")
}
})
Image($r('app.media.delete'))
@@ -527,7 +598,7 @@ export struct DeleteNoteComp {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("DeleteNoteComp, onDeleteConfirm, set continue note success")
LogUtil.info(TAG, "DeleteNoteComp, onDeleteConfirm, set continue note success")
}
build() {
@@ -25,7 +25,8 @@ import FolderUtil from '../../../../../../common/utils/src/main/ets/default/base
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import prompt from '@system.prompt'
import featureAbility from '@ohos.ability.featureAbility';
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
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"
@@ -45,14 +46,15 @@ export struct NoteContentCompPortrait {
private context = getContext(this)
noteContent = {
callbackhtml: (html) => {
LogUtil.info(TAG, 'html content is:' + html)
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
// 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, 'update note success:' + this.selectedNoteData)
LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid)
return "AceString";
}
}
@@ -84,7 +86,6 @@ export struct NoteContentCompPortrait {
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
console.log('onPageEnd:' + e.url)
// 初次进入预览模式
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({
@@ -232,39 +233,54 @@ export struct ToolBarComp {
if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) {
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)
// 迁移
console.log("ToolBarComp, set continue note")
LogUtil.info(TAG, "ToolBarComp, set continue note")
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
console.log("ToolBarComp, continueNote : " + continueNote)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("ToolBarComp, set continue note success")
LogUtil.info(TAG, "ToolBarComp, set continue note success")
}
})
}.width(36)
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
} else {
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 })
}
// 进入预览模式
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.editModel = false
})
Row({ space: StyleConstants.SPACE_6 }) {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.undo')).height(24).width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.undo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.todo')).height(24).width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
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")
}
// 进入预览模式
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.editModel = false
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
}
.width(120)
.width(130)
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
}
}
@@ -407,8 +423,7 @@ export struct EditNoteCompForPortrait {
Image($r('app.media.picture_white'))
.width(24)
.height(24)
.onClick(() => {
})
Text($r("app.string.photo"))
.fontSize(10).fontColor('#182431')
.padding({ top: 5 })
@@ -24,7 +24,7 @@ import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUt
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets'
import SearchModel from '../../../../../../common/utils/src/main/ets/default/model/searchModel/SearchModel.ets'
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
const TAG = "NoteListComp"
@@ -78,22 +78,24 @@ struct NoteOverViewComp {
build() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Image($r("app.media.suojin_back"))
.height(24)
.width(24)
.margin({ right: this.sectionStatus != 3 ? 24 : 0 }) // 两分栏时缩进图片与右边有个24的间距
.visibility(this.sectionStatus != 3 ? Visibility.Visible : Visibility.None)
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// 迁移
console.log("NoteOverViewComp, set continue section")
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("NoteOverViewComp, set continue section success")
}
})
Column() {
Image($r("app.media.suojin_back"))
.height(24)
.width(24)
.margin({ right: this.sectionStatus != 3 ? 24 : 0 }) // 两分栏时缩进图片与右边有个24的间距
.visibility(this.sectionStatus != 3 ? Visibility.Visible : Visibility.None)
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// 迁移
LogUtil.info(TAG, "NoteOverViewComp, set continue section")
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "NoteOverViewComp, set continue section success")
}
})
}.alignItems(HorizontalAlign.Center)
Flex({
direction: FlexDirection.Column,
wrap: FlexWrap.Wrap,
@@ -103,13 +105,16 @@ struct NoteOverViewComp {
Text(FolderUtil.getFolderText(this.selectedFolderData))
.fontSize(30)
.fontColor('#182431')
.fontWeight(FontWeight.Bold)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString())
.fontSize(14)
.fontColor('#182431')
.fontColor('#A3A7AD')
Text($r("app.string.noteslist"))
.fontSize(14)
.fontColor('#182431')
.fontColor('#A3A7AD')
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible)
}.visibility(this.longpress ? Visibility.None : Visibility.Visible)
@@ -127,6 +132,7 @@ struct NoteOverViewComp {
.fontSize(20)
.fontColor('#182431')
.margin({ left: 16 })
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(VerticalAlign.Center)
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
}.padding({ top: 8, bottom: 8 })
@@ -174,19 +180,21 @@ export struct NoteItemComp {
}), item => {
if (item.data.type == 0) {
Span(item.data.text).fontColor('#182431').fontSize(16)
Span(item.data.text).fontColor('#182431').fontSize(16).fontWeight(FontWeight.Medium)
} else if (item.data.type == 1) {
Span(item.data.text).fontColor(Color.Blue).fontSize(16)
Span(item.data.text).fontColor(Color.Blue).fontSize(16).fontWeight(FontWeight.Medium)
}
},
item => item.index)
}
}.textOverflow({ overflow: TextOverflow.Ellipsis })
}
Row({ space: 4 }) {
Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time)))
.fontSize(14)
.fontColor('#182431')
.fontColor('#99182431')
.fontWeight(FontWeight.Regular)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Image($r("app.media.favorite"))
.height(16)
.width(16)
@@ -201,11 +209,14 @@ export struct NoteItemComp {
}.width(240)
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image(this.noteItem.content_img)
.height(48)
.width(48)
.borderRadius(12)
.border({ width: 0.5, color: '#19182431' })
Stack({ alignContent: Alignment.Center }) {
Image(this.noteItem.content_img)
.height(48)
.width(48)
.borderRadius(12)
.border({ width: 0.5, color: '#19182431' })
.visibility(this.noteItem.content_img ? Visibility.Visible : Visibility.None)
}
Stack({ alignContent: Alignment.Center }) {
Image($r("app.media.unChecked"))
.height(24)
@@ -247,7 +258,7 @@ export struct NoteItemComp {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("NoteItemComp, set continue note success")
LogUtil.info(TAG, "NoteItemComp, set continue note success")
}
if(this.portraitModel == false) {
this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
@@ -294,10 +305,11 @@ export struct NoteItemListComp {
} else {
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
}
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("doSearch, set continue note success")
LogUtil.info(TAG, "doSearch, set continue note success")
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
})
}
@@ -349,8 +361,7 @@ export struct NoteItemListComp {
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
}
.backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notelist_bgcolor_f1f3f5"))
.opacity(this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_10 : StyleConstants.OPACITY_100)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.height('100%')
}
.height('80%')
@@ -387,7 +398,9 @@ export struct OperateNoteComp {
predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid)
RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null)
})
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)
this.longpress = false
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
}
@@ -427,7 +440,7 @@ export struct OperateNoteComp {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("OperateNoteComp, set continue note success")
LogUtil.info(TAG, "OperateNoteComp, set continue note success")
}
build() {
@@ -528,7 +541,12 @@ export struct AddNoteComp {
.height(24)
.margin({ right: 12 })
.onClick(() => {
let noteData = new NoteData(0, "标题", new Date().getTime() + "", this.selectedFolderData.uuid, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0)
let noteData
if (this.selectedFolderData.uuid == SysDefFolderUuid.AllNotes) {
noteData = new NoteData(0, "标题", new Date().getTime() + "", SysDefFolderUuid.UnClassified, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0)
} else {
noteData = new NoteData(0, "标题", new Date().getTime() + "", this.selectedFolderData.uuid, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0)
}
this.AllNoteArray.push(noteData)
RdbStoreUtil.insert(TableName.NoteTable, noteData.toNoteObject(), null)
@@ -551,7 +569,7 @@ export struct AddNoteComp {
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
console.log("addNote, set continue note and section success")
LogUtil.info(TAG, "addNote, set continue note and section success")
})
.visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible)
}
@@ -577,6 +595,7 @@ export struct SearchComp {
Image($r('app.media.search')).width(18).height(18)
TextInput({ text: this.inputKeyword, placeholder: $r('app.string.searchNote') })
.backgroundColor($r("app.color.color_ffffff"))
.caretColor('#F86D05')
.onChange((value: string) => {
LogUtil.info(TAG, "Search value: " + value)
this.inputKeyword = value
@@ -585,11 +604,12 @@ export struct SearchComp {
this.search = true
})
}
.width(this.search ? 344 : 384)
.height(52)
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.height(40)
.padding({ left: 6, right: 12, top: 9, bottom: 9 })
.borderRadius(20)
.backgroundColor($r("app.color.color_ffffff"))
.border({ width: 1.5, color: $r("app.color.divider_color_e4e4e4") })
.margin({ right: this.search ? 40 : 0 })
}
}
}
@@ -618,7 +638,9 @@ export struct OperateNoteCompForPortrait {
predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid)
RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null)
})
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)
this.longpress = false
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
}
@@ -655,7 +677,7 @@ export struct OperateNoteCompForPortrait {
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
console.log("OperateNoteCompForPortrait, set continue note success")
LogUtil.info(TAG, "OperateNoteCompForPortrait, set continue note success")
}
build() {
@@ -1,80 +0,0 @@
{
"color": [
{
"name": "color_ffffff",
"value": "#ffffff"
},
{
"name": "delete_color_fa2a2d",
"value": "#fa2a2d"
},
{
"name": "cancel_color_4fb4e3",
"value": "#4fb4e3"
},
{
"name": "divider_color_e4e4e4",
"value": "#cce4e4e4"
},
{
"name": "divider_color_182431",
"value": "#182431"
},
{
"name": "button_color_419fff",
"value": "#419fff"
},
{
"name": "button_color_fb4447",
"value": "#fb4447"
},
{
"name": "text_color_3f97e9",
"value": "#3f97e9"
},
{
"name": "text_color_f86d05",
"value": "#f86d05"
},
{
"name": "folder_color_182431",
"value": "#182431"
},
{
"name": "folder_color_f86d05",
"value": "#f86d05"
},
{
"name": "folder_color_ffffff",
"value": "#ffffff"
},
{
"name": "folder_color_19ffffff",
"value": "#19ffffff"
},
{
"name": "folder_color_19182431",
"value": "#19182431"
},
{
"name": "notecontent_color_ffffff",
"value": "#ffffff"
},
{
"name": "notecontent_color_000000",
"value": "#000000"
},
{
"name": "folderlist_bgcolor_f1f3f5",
"value": "#f1f3f5"
},
{
"name": "notelist_bgcolor_f1f3f5",
"value": "#f1f3f5"
},
{
"name": "notelist_bgcolor_000000",
"value": "#000000"
}
]
}
@@ -1,136 +0,0 @@
{
"float": [
{
"name": "wh_value_1",
"value": "1"
},
{
"name": "wh_value_4",
"value": "4"
},
{
"name": "wh_value_5",
"value": "5"
},
{
"name": "wh_value_8",
"value": "8"
},
{
"name": "wh_value_10",
"value": "10"
},
{
"name": "wh_value_14",
"value": "14"
},
{
"name": "wh_value_16",
"value": "16"
},
{
"name": "wh_value_20",
"value": "20"
},
{
"name": "wh_value_24",
"value": "24"
},
{
"name": "wh_value_30",
"value": "30"
},
{
"name": "wh_value_40",
"value": "40"
},
{
"name": "wh_value_50",
"value": "50"
},
{
"name": "wh_value_60",
"value": "60"
},
{
"name": "wh_value_65",
"value": "65"
},
{
"name": "wh_value_70",
"value": "70"
},
{
"name": "wh_value_80",
"value": "80"
},
{
"name": "wh_value_100",
"value": "100"
},
{
"name": "wh_value_120",
"value": "120"
},
{
"name": "wh_value_130",
"value": "1300"
},
{
"name": "wh_value_160",
"value": "160"
},
{
"name": "wh_value_230",
"value": "230"
},
{
"name": "wh_value_280",
"value": "280"
},
{
"name": "wh_value_390",
"value": "390"
},
{
"name": "wh_value_400",
"value": "400"
},
{
"name": "font_35",
"value": "35"
},
{
"name": "font_15",
"value": "15"
},
{
"name": "font_20",
"value": "20"
},
{
"name": "font_25",
"value": "25"
},
{
"name": "font_28",
"value": "28"
},
{
"name": "font_50",
"value": "50"
},
{
"name": "control_common_font_size",
"value": "20"
},
{
"name": "slider_text_padding_left",
"value": "5"
},
{
"name": "volume_border_radius",
"value": "15"
}
]
}
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {LogUtil} from '../baseUtil/LogUtil.ets'
import MediaLib from '@ohos.multimedia.mediaLibrary';
const TAG = "MediaLibraryAccess"
export class MediaLibraryAccess {
static async getFirstObject(fetchOpt, context) {
let album = {
count: 0,
obj: null,
}
try {
// 通过Uri拷贝图片到指定指定的包路径下
// 1、获取本地路径
let fileResult = await MediaLib.getMediaLibrary(context).getFileAssets(fetchOpt)
if (fileResult != undefined) {
album.count = fileResult.getCount();
if (album.count <= 0) {
return album;
}
let file = await fileResult.getFirstObject();
if (file) {
album.obj = file;
return album;
} else {
LogUtil.warn(TAG, 'Failed getFirstObject')
}
}
return album;
}
catch (error) {
LogUtil.error(TAG, `getFirstObject loadData error: ${error}`)
return album;
}
}
static async openAsset(mode: string, fileAsset: any) {
LogUtil.info(TAG, 'openAsset start')
let fd = await fileAsset.open(mode);
LogUtil.info(TAG, `openAsset end. fd: ${fd}`)
if (fd <= 0) {
LogUtil.warn(TAG, 'openAsset Fail')
return;
}
return fd;
}
static async closeAsset(fd: number, fileAsset: any) {
LogUtil.info(TAG, 'closeAsset start')
if (fd <= 0) {
LogUtil.warn(TAG, 'closeAsset fd is invalid')
return;
}
try {
await fileAsset.close(fd)
LogUtil.info(TAG, 'closeAsset end')
} catch (error) {
LogUtil.warn(TAG, 'closeAsset fail')
}
}
}
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import LogUtil from './LogUtil.ets'
import {LogUtil} from './LogUtil.ets'
import GlobalResourceManager from './GlobalResourceManager.ets'
const TAG = "DateUtil"
@@ -38,7 +38,7 @@ export class DateUtil {
let nowDate = new Date()
let diffMin = Math.floor((nowDate.getTime() - date.getTime()) / 1000 / 60)
if (diffMin < 0) {
LogUtil.info("DateUtils, formateDateForNoteTitle : date is error")
LogUtil.info(TAG, "DateUtils, formateDateForNoteTitle : date is error")
return this.formateDateForNoteContent(date)
}
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import LogUtil from '../../common/baseUtil/LogUtil.ets'
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'
@@ -52,10 +52,10 @@ export default {
AppStorage.SetOrCreate('AllNoteArray', noteDataArray)
AppStorage.SetOrCreate('AllFolderArray', folderDataArray)
for (let folderData of folderDataArray) {
LogUtil.info(TAG, "folderData : " + JSON.stringify(folderData))
LogUtil.info(TAG, "folderDataUuid : " + JSON.stringify(folderData.uuid))
}
for (let noteData of noteDataArray) {
LogUtil.info(TAG, "noteDataArray : " + JSON.stringify(noteData))
LogUtil.info(TAG, "noteDataArrayUuid : " + JSON.stringify(noteData.uuid))
}
AppStorage.SetOrCreate('DBQueryFinished', 1)
}
@@ -18,7 +18,7 @@ import NoteData from '../model/databaseModel/NoteData.ets'
import {SysDefFolderUuid, FolderType, Favorite, Delete} from '../model/databaseModel/EnumData.ets'
import GlobalResourceManager from './GlobalResourceManager.ets'
import StyleConstants from '../constants/StyleConstants.ets'
import LogUtil from './LogUtil.ets'
import {LogUtil} from './LogUtil.ets'
const TAG = "FolderUtil"
@@ -13,6 +13,7 @@
* limitations under the License.
*/
import Rsm from '@ohos.resourceManager';
import {LogUtil} from './LogUtil.ets'
const TAG = "Note_GlobalResourceManager"
@@ -20,7 +21,7 @@ export class GlobalResourceManager {
public async getStringByResource(res: any): Promise<string> {
let json = JSON.parse(JSON.stringify(res));
let id = json.id;
console.info(TAG, "ResourceID = %d", id)
LogUtil.info(TAG, "ResourceID = %d" + id)
return await this.getStringById(id);
}
@@ -31,16 +32,16 @@ export class GlobalResourceManager {
result.getString(id)
.then((resource) => {
resolve(resource);
console.info('getStringById resolve(resource) : ' + resolve(resource));
console.info('getStringById resource : ' + resource);
console.info('getStringById resource2 : ' + JSON.stringify(resource));
LogUtil.info(TAG, 'getStringById resolve(resource) : ' + resolve(resource));
LogUtil.info(TAG, 'getStringById resource : ' + resource);
LogUtil.info(TAG, 'getStringById resource2 : ' + JSON.stringify(resource));
})
.catch((err) => {
console.info('getStringById err : ' + JSON.stringify(err));
LogUtil.info(TAG, 'getStringById err : ' + JSON.stringify(err));
});
});
});
console.info('getStringById promise: ' + JSON.stringify(promise));
LogUtil.info(TAG, 'getStringById promise: ' + JSON.stringify(promise));
return promise;
}
}
@@ -19,7 +19,7 @@ import NoteData from '../model/databaseModel/NoteData.ets'
import {SysDefFolderUuid, FolderType, Favorite, Delete} from '../model/databaseModel/EnumData.ets'
import GlobalResourceManager from './GlobalResourceManager.ets'
import StyleConstants from '../constants/StyleConstants.ets'
import LogUtil from './LogUtil.ets'
import {LogUtil} from './LogUtil.ets'
import FolderUtil from './FolderUtil.ets'
import NoteUtil from './NoteUtil.ets'
@@ -17,57 +17,19 @@
* Log Util
*/
export class LogUtil {
getLogFirstStr(tag: string, ...msg) {
let firstStr: string = tag + ", " + msg[0] + " "
try {
throw new Error();
} catch (e) {
firstStr += e.stack.split('at ')[3].split(' ')[0]
}
return firstStr
static debug(tag: string, msg: string) {
console.debug(tag + ', ' + msg)
}
debug(tag: string, ...msg) {
if (msg.length == 0) {
console.debug(tag)
return
}
let firstStr = this.getLogFirstStr(tag, ...msg)
msg.shift()
console.debug(firstStr, ...msg)
static info(tag: string, msg: string) {
console.info(tag + ', ' + msg)
}
info(tag: string, ...msg) {
if (msg.length == 0) {
console.debug(tag)
return
}
let firstStr = this.getLogFirstStr(tag, ...msg)
msg.shift()
console.info(firstStr, ...msg)
static warn(tag: string, msg: string) {
console.warn(tag + ', ' + msg)
}
warn(tag: string, ...msg) {
if (msg.length == 0) {
console.debug(tag)
return
}
let firstStr = this.getLogFirstStr(tag, ...msg)
msg.shift()
console.warn(firstStr, ...msg)
static error(tag: string, msg: string) {
console.error(tag + ', ' + msg)
}
error(tag: string, ...msg) {
if (msg.length == 0) {
console.debug(tag)
return
}
let firstStr = this.getLogFirstStr(tag, ...msg)
msg.shift()
console.error(firstStr, ...msg)
}
}
let mLogUtil = new LogUtil();
export default mLogUtil as LogUtil
}
@@ -18,7 +18,7 @@ import NoteData from '../model/databaseModel/NoteData.ets'
import {SysDefFolderUuid, FolderType, Favorite, Delete, TableName, NoteTableColumn,} from '../model/databaseModel/EnumData.ets'
import GlobalResourceManager from './GlobalResourceManager.ets'
import StyleConstants from '../constants/StyleConstants.ets'
import LogUtil from './LogUtil.ets'
import {LogUtil} from './LogUtil.ets'
import FolderUtil from './FolderUtil.ets'
import RdbStoreUtil from './RdbStoreUtil.ets'
import prompt from '@system.prompt'
@@ -138,7 +138,10 @@ export class NoteUtil {
LogUtil.info(TAG, "NoteBgColor is ffffff")
return $r("app.color.color_ffffff")
}
LogUtil.info(TAG, "isSelected %s, folderData.color: %s", isSelected, folderData.color)
if (folderData.color == "#ffffff") {
return "#FFEBE1"
}
LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + isSelected.toString() + folderData.color.toString())
return isSelected ? selectedNoteBgColorMap[folderData.color] : unSelectedNoteBgColorMap[folderData.color]
}
@@ -155,7 +158,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)
LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + folderData.color.toString())
if (folderData.color == "#ffffff") {
return "#ff9516"
}
@@ -213,7 +216,7 @@ export class NoteUtil {
if (noteItemRight.is_top != noteItemLeft.is_top) {
return noteItemRight.is_top - noteItemLeft.is_top
}
return noteItemRight.created_time - noteItemLeft.created_time
return noteItemRight.modified_time - noteItemLeft.modified_time
})
LogUtil.info(TAG, "noteDataArray size " + noteDataArray.length.toString())
return noteDataArray
@@ -247,11 +250,9 @@ export class NoteUtil {
}
deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[],controllerShow: WebController):boolean {
LogUtil.info(TAG, selectedNoteData.content_text)
if (selectedNoteData.title == "标题" && selectedNoteData.content_text == "") {
// delete note from db
noteUtil.removeNoteData(AllNoteArray,selectedNoteData.uuid)
LogUtil.info(TAG, "delete note:" + selectedNoteData.content_text)
LogUtil.info(TAG, "delete note:" + selectedNoteData.uuid)
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, selectedNoteData.uuid)
@@ -0,0 +1,95 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {LogUtil} from './LogUtil.ets'
import {MediaLibraryAccess} from '../access/MediaLibraryAccess.ets';
import fileio from '@ohos.fileio';
const TAG = "OperationUtils"
export class OperationUtils {
async copy(uri: string):Promise<string> {
try {
let numId = this.getIdByUri(uri)
var context = globalThis.noteContext
let fileAsset = await this.getFileAssetById(numId,context);
if (fileAsset == null || fileAsset == undefined) {
LogUtil.warn(TAG, "Failed to get fileAsset")
return;
}
let fd = await MediaLibraryAccess.openAsset('RW', fileAsset);
if (fd <= 0) {
LogUtil.warn(TAG, "fd is invaild")
return;
}
LogUtil.info(TAG, 'copyAsset read end!')
// 通过Uri拷贝图片到指定指定的包路径下
// 1、获取本地路径
var dir = context.filesDir
// 2、生成本地文件名
var time = new Date().getTime()
var imagePath = dir + "/" + time.toString().substr(10) + "_note"+ numId + ".jpg"
// 3、拷贝
fileio.copyFile(fd, imagePath).then(() => {
LogUtil.info(TAG, "[save]copyFile successfully")
}).catch((err) => {
LogUtil.info(TAG, "[save]copyFile failed : " + err)
});
// 4、关闭安fd,Asset
fileAsset.close(fd);
await MediaLibraryAccess.closeAsset(fd, fileAsset);
} catch (error) {
LogUtil.info(TAG, "create error: " + error);
return;
}
LogUtil.debug(TAG, 'copy end');
return imagePath.toString()
}
getIdByUri(uri:string): number {
let srcIndex = uri.lastIndexOf('/');
let srcEnd = uri.length;
let srcId = uri.substring(srcIndex + 1, srcEnd);
let numId = new Number(srcId);
LogUtil.debug(TAG, `getIdByUri numId: ${numId}`);
return numId.valueOf();
}
async getFileAssetById(id,context){
LogUtil.info(TAG, 'getFileAssetById');
let fetchOpt = {
selections : 'file_id =?',
selectionArgs : [`${id}`],
}
try {
let result = await MediaLibraryAccess.getFirstObject(fetchOpt,context);
if (result == null) {
LogUtil.info(TAG, 'getFileAssetByUri fail');
return null;
}
return result.obj;
} catch (error) {
LogUtil.info(TAG, 'getFileAssetById error');
return null;
}
}
}
let mOperationUtils = new OperationUtils();
export default mOperationUtils as OperationUtils;
@@ -14,8 +14,10 @@
*/
import ohosDataRdb from '@ohos.data.rdb'
import LogUtil from './LogUtil.ets'
import fileio from '@ohos.fileio'
import {LogUtil} from './LogUtil.ets'
import FolderUtil from './FolderUtil.ets'
import NoteUtil from './NoteUtil.ets'
import SysDefData from '../model/databaseModel/SysDefData.ets'
import FolderData from '../model/databaseModel/FolderData.ets'
import NoteData from '../model/databaseModel/NoteData.ets'
@@ -91,7 +93,7 @@ export default {
let isContinue = AppStorage.Get('IsContinue');
LogUtil.info(TAG, "createRdbStore, isContinue is " + isContinue)
if (isContinue != undefined && isContinue == 1) {
console.info("RdbStoreUtil createRdbStore, IsContinue true")
LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue true")
let continueFolder: string = AppStorage.Get('ContinueFolder')
let continueNote: string = AppStorage.Get('ContinueNote')
let continueSection = AppStorage.Get('ContinueSection')
@@ -105,6 +107,19 @@ export default {
noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite,
noteObj.is_deleted, noteObj.created_time, noteObj.modified_time, noteObj.deleted_time)
// save img to FileDir
LogUtil.info(TAG, "createRdbStore, save img to FileDir")
let srcArray = this.getSrcFromHtml(decodeURI(noteObj.content_text))
srcArray.forEach((src: string) => {
let lastIndex = src.lastIndexOf('/')
LogUtil.info(TAG, " createRdbStore, lastIndex : " + lastIndex)
if (lastIndex != -1) {
let imgName = src.substring(lastIndex + 1)
this.writeToFileDir(context, imgName)
}
})
LogUtil.info(TAG, "createRdbStore, save img to FileDir success")
// if not exit this note
let exist = false
let folderUuid = ""
@@ -115,30 +130,41 @@ export default {
break
}
}
console.log("RdbStoreUtil initAppStorage, exist : " + exist)
// 迁移过来的笔记在本地不存在,则保存在未分类文件夹
LogUtil.info(TAG, "createRdbStore, exist : " + exist)
if (!exist) {
// 迁移过来的笔记在本地不存在,则保存在未分类文件夹
noteData.folder_uuid = SysDefFolderUuid.UnClassified
noteDataArray.push(noteData)
AppStorage.SetOrCreate('AllNoteArray', noteDataArray)
this.insert(TableName.NoteTable, noteData.toNoteObject(), null)
AppStorage.SetOrCreate('Folder', FolderUtil.getFolderData(folderDataArray, SysDefFolderUuid.UnClassified))
} else {
// 迁移过来的笔记在本地存在,则进行修改
for (let i = 0; i < noteDataArray.length; i++) {
if (noteData.created_time == noteDataArray[i].created_time) {
noteDataArray[i] = noteData
LogUtil.info(TAG, "createRdbStore, update noteData in noteDataArray success")
break
}
}
let predicates_note = this.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.CreatedTime, noteData.created_time)
this.update(noteData.toNoteObject(), predicates_note, null)
AppStorage.SetOrCreate('Folder', FolderUtil.getFolderData(folderDataArray, folderUuid))
}
AppStorage.SetOrCreate('Note', noteData)
AppStorage.SetOrCreate('Section', continueSection)
} else {
console.info("RdbStoreUtil createRdbStore, IsContinue false")
LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue false")
AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0])
AppStorage.SetOrCreate('Note', AppStorage.Get('AllNoteArray')[0])
AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes))
AppStorage.SetOrCreate('Section', 3)
}
AppStorage.SetOrCreate('DBQueryFinished', 1)
LogUtil.info(TAG, "createRdbStore, set DBQueryFinished 1")
})
.catch((err) => {
LogUtil.error(TAG, "createRdbStore, error : " + err)
LogUtil.warn(TAG, "createRdbStore, error : " + err)
})
},
@@ -213,6 +239,19 @@ export default {
noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite,
noteObj.is_deleted, noteObj.created_time, noteObj.modified_time, noteObj.deleted_time)
// save img to FileDir
LogUtil.info(TAG, "initAppStorage, save img to FileDir")
let srcArray = this.getSrcFromHtml(decodeURI(noteObj.content_text))
srcArray.forEach((src: string) => {
let lastIndex = src.lastIndexOf('/')
LogUtil.info(TAG, " initAppStorage, lastIndex : " + lastIndex)
if (lastIndex != -1) {
let imgName = src.substring(lastIndex + 1)
this.writeToFileDir(context, imgName)
}
})
LogUtil.info(TAG, "initAppStorage, save img to FileDir success")
// if not exit this note
let exist = false
let folderUuid = ""
@@ -223,33 +262,86 @@ export default {
break
}
}
console.log("RdbStoreUtil initAppStorage, exist : " + exist)
// 迁移过来的笔记在本地不存在,则保存在未分类文件夹
LogUtil.info(TAG, "initAppStorage, exist : " + exist)
if (!exist) {
// 迁移过来的笔记在本地不存在,则保存在未分类文件夹
noteData.folder_uuid = SysDefFolderUuid.UnClassified
noteDataArray.push(noteData)
AppStorage.SetOrCreate('AllNoteArray', noteDataArray)
this.insert(TableName.NoteTable, noteData.toNoteObject(), null)
AppStorage.SetOrCreate('Folder', FolderUtil.getFolderData(folderDataArray, SysDefFolderUuid.UnClassified))
} else {
// 迁移过来的笔记在本地存在,则进行修改
for (let i = 0; i < noteDataArray.length; i++) {
if (noteData.created_time == noteDataArray[i].created_time) {
noteDataArray[i] = noteData
LogUtil.info(TAG, "initAppStorage, update noteData in noteDataArray success")
break
}
}
let predicates_note = this.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.CreatedTime, noteData.created_time)
this.update(noteData.toNoteObject(), predicates_note, null)
AppStorage.SetOrCreate('Folder', FolderUtil.getFolderData(folderDataArray, folderUuid))
}
AppStorage.SetOrCreate('Note', noteData)
AppStorage.SetOrCreate('Section', continueSection)
} else {
console.info("RdbStoreUtil initAppStorage, IsContinue false")
LogUtil.info(TAG, "RdbStoreUtil initAppStorage, IsContinue false")
AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0])
AppStorage.SetOrCreate('Note', AppStorage.Get('AllNoteArray')[0])
AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes))
AppStorage.SetOrCreate('Section', 3)
}
AppStorage.SetOrCreate('DBQueryFinished', 1)
LogUtil.info(TAG, "initAppStorage, set DBQueryFinished 1")
})
.catch((err) => {
LogUtil.error(TAG, "initAppStorage, error : " + err)
LogUtil.warn(TAG, "initAppStorage, error : " + err)
})
},
getSrcFromHtml(html: string): any{
LogUtil.info(TAG, "getSrcFromHtml, html : " + html)
let imgReg = /<img[^>]+>/g
let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i
let imgArray = html.match(imgReg)
let srcArray = []
if (imgArray != null) {
for (let i = 0; i < imgArray.length; i++) {
let src = imgArray[i].match(srcReg)
LogUtil.info(TAG, "getSrcFromHtml, src[1] : " + src[1])
srcArray.push(src[1])
}
}
LogUtil.info(TAG, "getSrcFromHtml, srcArray : " + srcArray)
return srcArray
},
writeToFileDir(context, fileName: string) {
LogUtil.info(TAG, "writeToFileDir fileName : " + fileName)
let distributedFilesDir = context.distributedFilesDir
let srcPath = distributedFilesDir + "/" + fileName
let srcFd
try {
srcFd = fileio.openSync(srcPath, 0o2, 0o666)
LogUtil.info(TAG, "open srcPath success : " + srcFd)
} catch (err) {
LogUtil.warn(TAG, "open srcPath failed : " + err)
}
let filesDir = context.filesDir
let desPath = filesDir + "/" + fileName
try {
fileio.copyFileSync(srcFd, desPath)
LogUtil.info(TAG, "writeToFileDir, copyFile successfully")
} catch (err) {
LogUtil.warn(TAG, "writeToFileDir, copyFile failed : " + err)
}
},
/**
* insert
* @param tableName
@@ -263,7 +355,7 @@ export default {
callback(rowId)
}
}).catch((err) => {
LogUtil.error(TAG, "insert error : " + err)
LogUtil.warn(TAG, "insert error : " + err)
})
},
@@ -279,7 +371,7 @@ export default {
callback(affectedRowCount)
}
}).catch((err) => {
LogUtil.error(TAG, "delete error : " + err)
LogUtil.warn(TAG, "delete error : " + err)
})
},
@@ -296,7 +388,7 @@ export default {
callback(affectedRowCount)
}
}).catch((err) => {
LogUtil.error(TAG, "update error : " + err)
LogUtil.warn(TAG, "update error : " + err)
})
},
@@ -313,7 +405,7 @@ export default {
callback(resultSet)
}
}).catch((err) => {
LogUtil.error(TAG, "query error : " + err)
LogUtil.warn(TAG, "query error : " + err)
})
},
@@ -323,5 +415,23 @@ export default {
*/
getRdbPredicates(tableName) {
return new ohosDataRdb.RdbPredicates(tableName)
},
updataNoteImage(content):string {
let srcArray = this.getSrcFromHtml(decodeURI(content))
LogUtil.info(TAG, "getSrcFromHtml, srcArray : " + srcArray)
if(srcArray.length == 0) {
return ""
}
if(srcArray[0] == './shuxue.png' || srcArray[0] == './lvyou.png' || srcArray[0] == './cake.png') {
let lastIndex = srcArray[0].lastIndexOf('/')
LogUtil.info(TAG, "lastIndex : " + lastIndex)
let imgName = ""
if (lastIndex != -1) {
imgName = srcArray[0].substring(lastIndex + 1)
}
return "/res/" + imgName
}
return srcArray[0]
}
}
@@ -17,6 +17,7 @@ export default class StyleConstants {
public static PERCENTAGE_100: string = '100%'
public static PERCENTAGE_60: string = '60%'
public static PERCENTAGE_0: string = '0%'
public static SPACE_6: number = 6
public static SPACE_24: number = 24
public static NOTE_LIST_BACKGROUND: string = "#f1f3f5"
public static DELETE_DEADLINE: number = 2592000000 // 30 days (30 * 24 * 60 * 60 * 1000)ms
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import LogUtil from '../../baseUtil/LogUtil.ets'
import {LogUtil} from '../../baseUtil/LogUtil.ets'
import NoteData from '../../model/databaseModel/NoteData.ets'
import ohosDataRdb from '@ohos.data.rdb';
import {TableName, NoteTableColumn} from '../../model/databaseModel/EnumData.ets'
@@ -42,7 +42,7 @@ export class SearchModel {
}
let searchData: NoteData[] = [];
noteDataArray.forEach((noteData) => {
if (noteData.content_text.toLowerCase().indexOf(query.toLowerCase()) != -1
if (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);
+6 -2
View File
@@ -12,11 +12,15 @@
* 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"
export default {
onCreate() {
console.info('Application onCreate')
LogUtil.info(TAG, 'Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
LogUtil.info(TAG, 'Application onDestroy')
},
}
@@ -102,7 +102,7 @@
},
{
"name": "searchNote",
"value": "搜索笔记"
"value": "搜索笔记..."
},
{
"name": "chooseFolder",
@@ -135,6 +135,34 @@
{
"name": "check_all",
"value": "多选"
},
{
"name": "editNoteTitle",
"value": "修改标题"
},
{
"name": "list",
"value": "清单"
},
{
"name": "style",
"value": "样式"
},
{
"name": "photo",
"value": "相册"
},
{
"name": "title",
"value": "标题"
},
{
"name": "empty_note",
"value": "笔记内容为空"
},
{
"name": "restore",
"value": "已恢复"
}
]
}
@@ -0,0 +1,168 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "Notepad"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "note",
"value": "Notes"
},
{
"name": "allNotes",
"value": "All notes"
},
{
"name": "unClassified",
"value": "No category"
},
{
"name": "recentDeletes",
"value": "Recently deleted"
},
{
"name": "myFavorites",
"value": "My favourites"
},
{
"name": "create",
"value": "NEW"
},
{
"name": "createFolder",
"value": "New Folder"
},
{
"name": "editFolder",
"value": "Edit Folder"
},
{
"name": "deleteFolder",
"value": "Delete Folder"
},
{
"name": "createNote",
"value": "New note"
},
{
"name": "cancel",
"value": "CANCEL"
},
{
"name": "save",
"value": "SAVE"
},
{
"name": "delete",
"value": "DELETE"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "Do you want to delete this folder and its contents?"
},
{
"name": "deleteNote",
"value": "Delete this note?"
},
{
"name": "deleteNoteComplete",
"value": "Permanently delete this note?"
},
{
"name": "deleteAllNote",
"value": "Delete all note?"
},
{
"name": "deletePartNote",
"value": "Delete %d notes?"
},
{
"name": "selected",
"value": "%d item selected"
},
{
"name": "none_selected",
"value": "None selected"
},
{
"name": "noteslist",
"value": "notes"
},
{
"name": "Empty_page",
"value": "No notes"
},
{
"name": "searchNote",
"value": "Search notes"
},
{
"name": "chooseFolder",
"value": "Select folder"
},
{
"name": "category_already_exist",
"value": "The folder name already exists."
},
{
"name": "input_placeholder",
"value": "Name"
},
{
"name": "permanently_delete_tips",
"value": "notes will be permanently deleted after the number of days shown (up to 30 days)."
},
{
"name": "set_top",
"value": "Top"
},
{
"name": "move",
"value": "Move"
},
{
"name": "recover",
"value": "Restore"
},
{
"name": "check_all",
"value": "Select all"
},
{
"name": "editNoteTitle",
"value": "Modify the title"
},
{
"name": "list",
"value": "Checklist"
},
{
"name": "style",
"value": "Style"
},
{
"name": "photo",
"value": "Gallery"
},
{
"name": "title",
"value": "Title"
},
{
"name": "empty_note",
"value": "The note content is empty."
},
{
"name": "restore",
"value": "Note Restored"
}
]
}
@@ -0,0 +1,168 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "备忘录"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "note",
"value": "笔记"
},
{
"name": "allNotes",
"value": "全部笔记"
},
{
"name": "unClassified",
"value": "未分类"
},
{
"name": "recentDeletes",
"value": "最近删除"
},
{
"name": "myFavorites",
"value": "我的收藏"
},
{
"name": "create",
"value": "新建"
},
{
"name": "createFolder",
"value": "新建文件夹"
},
{
"name": "editFolder",
"value": "编辑文件夹"
},
{
"name": "deleteFolder",
"value": "删除文件夹"
},
{
"name": "createNote",
"value": "新建笔记"
},
{
"name": "cancel",
"value": "取消"
},
{
"name": "save",
"value": "保存"
},
{
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
},
{
"name": "deleteNote",
"value": "是否删除此笔记?"
},
{
"name": "deleteNoteComplete",
"value": "此笔记将被永久删除,无法恢复。是否删除?"
},
{
"name": "deleteAllNote",
"value": "是否删除全部笔记?"
},
{
"name": "deletePartNote",
"value": "是否删除%d条笔记?"
},
{
"name": "selected",
"value": "已选择%d项"
},
{
"name": "none_selected",
"value": "未选择"
},
{
"name": "noteslist",
"value": "条笔记"
},
{
"name": "Empty_page",
"value": "没有笔记"
},
{
"name": "searchNote",
"value": "搜索笔记..."
},
{
"name": "chooseFolder",
"value": "请选择文件夹"
},
{
"name": "category_already_exist",
"value": "文件夹名称已存在"
},
{
"name": "input_placeholder",
"value": "名称"
},
{
"name": "permanently_delete_tips",
"value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除"
},
{
"name": "set_top",
"value": "置顶"
},
{
"name": "move",
"value": "移到"
},
{
"name": "recover",
"value": "恢复"
},
{
"name": "check_all",
"value": "多选"
},
{
"name": "editNoteTitle",
"value": "修改标题"
},
{
"name": "list",
"value": "清单"
},
{
"name": "style",
"value": "样式"
},
{
"name": "photo",
"value": "相册"
},
{
"name": "title",
"value": "标题"
},
{
"name": "empty_note",
"value": "笔记内容为空"
},
{
"name": "restore",
"value": "已恢复"
}
]
}
+14
View File
@@ -67,6 +67,20 @@
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.READ_MEDIA",
"reason": "$string:per_read_media"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "$string:per_get_bundleInfo"
},
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "$string:per_dis_dataSync"
}
]
}
}
@@ -1,18 +1,3 @@
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
@@ -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
@@ -14,10 +14,28 @@
*/
import Ability from '@ohos.application.Ability'
import {WebViewUtil} from './WebViewUtil.ets'
import fileio from '@ohos.fileio'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason)
if (launchParam.launchReason == 3) {
// 获取对端的迁移数据
let continueFolder: string = want.parameters["ContinueFolder"]
let continueNote: string = want.parameters["ContinueNote"]
let continueSection: number = want.parameters["ContinueSection"]
// 迁移数据存入AppStorage
AppStorage.SetOrCreate<string>('ContinueFolder', continueFolder)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', continueSection)
// 设置迁移标记
AppStorage.SetOrCreate<number>('IsContinue', 1)
this.context.restoreWindowStage(null)
}
AppStorage.SetOrCreate<number>('openPhoto', 0)
AppStorage.SetOrCreate<number>('openPerm', 0)
globalThis.noteContext = this.context
}
onDestroy() {
@@ -39,5 +57,14 @@ export default class MainAbility extends Ability {
onBackground() {
console.log("MainAbility onBackground")
let controllerShow = WebViewUtil.getWebController()
if (controllerShow == undefined || controllerShow == null) {
console.info("MainAbility onBackground, controllerShow is error")
}
console.log("MainAbility controllerShow : " + controllerShow)
controllerShow.runJavaScript({
script: "get_html_content()"
})
console.log("MainAbility controllerShow end")
}
}
}
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* WebView Util
*/
export class WebViewUtil {
private static controllerShow: WebController
private constructor() {
}
public static getWebController(): WebController{
console.info('WebViewUtil, getWebController')
if (!this.controllerShow && AppStorage.Get('openPhoto') == 0 && AppStorage.Get('openPerm') == 0) {
console.info('WebViewUtil, controllerShow is null')
this.controllerShow = new WebController()
}
return this.controllerShow
}
}
+16 -1
View File
@@ -1,4 +1,19 @@
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
const TAG = "NoteApp"
@@ -14,9 +14,11 @@
*/
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 {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
@Entry
@@ -44,19 +46,54 @@ export struct MyNoteHomeComp {
LogUtil.info(this.TAG, "aboutToAppear")
if (this.context == undefined || this.context == null) {
LogUtil.error(this.TAG, "context is error")
LogUtil.warn(this.TAG, "context is error")
return
}
LogUtil.info(this.TAG, "databaseDir is " + this.context.databaseDir)
// /data/storage/el2/database/tablet
let dbPath = "/data/app/el2/100/database/com.ohos.note/phone/db/note.db"
try {
if (fileio.accessSync(dbPath) == undefined) {
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
let permissionList: Array<string> = [
"ohos.permission.READ_MEDIA",
"ohos.permission.DISTRIBUTED_DATASYNC"
]
bundle.getApplicationInfo('com.ohos.note', 0, 100).then((appInfo) => {
let tokenId = appInfo.accessTokenId
let statusPromise: Array<Promise<number>> = []
let requestList: Array<string> = []
let atManager = abilityAccessCtrl.createAtManager()
for (let i = 0; i < permissionList.length; i++) {
statusPromise.push(atManager.verifyAccessToken(tokenId, permissionList[i]))
}
Promise.all(statusPromise).then((status) => {
for (let i = 0; i < status.length; i++) {
if (status[i] == abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
requestList.push(permissionList[i])
}
}
if (requestList.length != 0) {
AppStorage.SetOrCreate<number>('openPerm', 1)
LogUtil.info(this.TAG, 'permissions need to require from user: ' + requestList)
this.context.requestPermissionsFromUser(requestList).then((data) => {
LogUtil.info(this.TAG, 'data permissions : ' + data.permissions)
LogUtil.info(this.TAG, 'data result: ' + data.authResults)
let sum = 0
for (let i = 0; i < data.authResults.length; i++) {
sum += data.authResults[i]
}
LogUtil.info(this.TAG, 'request permissions sum: ' + sum)
AppStorage.SetOrCreate<number>('openPerm', 0)
}, (err) => {
LogUtil.warn(this.TAG, 'failed to requestPermissionsFromUser : ' + err.code);
});
} else {
LogUtil.info(this.TAG, 'check all permissions are granted.')
}
})
})
let dbPath = this.context.databaseDir + "/db/note.db"
try {
fileio.accessSync(dbPath)
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
} catch (err) {
LogUtil.info(this.TAG, "db has not created, start to create db")
RdbStoreUtil.createRdbStore(this.context)
@@ -17,7 +17,7 @@ import {FolderListComp} from '../../../../../../../common/component/src/main/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 {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'
@@ -33,7 +33,7 @@ export struct NoteHomeComp {
@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')
@@ -60,7 +60,6 @@ export struct NoteHomeComp {
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.folderListVisibility == 0 ? Visibility.None : Visibility.Visible)
.opacity(this.search ? StyleConstants.OPACITY_40 : StyleConstants.OPACITY_100)
.enabled(this.search ? false : true)
Divider()
@@ -92,10 +91,9 @@ export struct NoteHomeComp {
NoteContentComp()
}
.flexShrink(0)
.backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notecontent_color_ffffff"))
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight)
.height(StyleConstants.PERCENTAGE_100)
.opacity(this.longpress ? StyleConstants.OPACITY_40 : this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_20 : StyleConstants.OPACITY_100)
.enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true)
}
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
@@ -17,7 +17,7 @@ import {FolderListComp} from '../../../../../../../common/component/src/main/ets
import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets'
import {NoteContentCompPortrait} from '../../../../../../../common/component/src/main/ets/default/NoteContentCompPortrait.ets'
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 {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'
@@ -34,7 +34,7 @@ export struct NoteHomePortraitComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
// 当前文件夹、笔记、分栏
// 当前文件夹、笔记、分栏
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')
@Provide('SectionStatus') sectionStatus: number = 1; // 表示分栏状态, 3表示三分栏, 2表示二分栏,1表示一分栏
@@ -163,6 +163,18 @@
{
"name": "restore",
"value": "已恢复"
},
{
"name": "per_read_media",
"value": "是否允许备忘录访问媒体资源"
},
{
"name": "per_get_bundleInfo",
"value": "是否允许备忘录打开图库资源"
},
{
"name": "per_dis_dataSync",
"value": "是否允许备忘录流转到其它设备"
}
]
}
@@ -3,7 +3,7 @@
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 18 18" style="enable-background:new 0 0 18 18;" xml:space="preserve">
<style type="text/css">
.st0{fill:#007DFF;}
.st0{fill:#F86D05;}
</style>
<title>搜索</title>
<path class="st0" d="M13.2,12.2l2.4,2.4c0.3,0.3,0.3,0.8,0,1.1s-0.8,0.3-1.1,0l-2.4-2.4C12.5,13,12.9,12.6,13.2,12.2z M7.8,1.5

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 840 B

@@ -0,0 +1,168 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "Notepad"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "note",
"value": "Notes"
},
{
"name": "allNotes",
"value": "All notes"
},
{
"name": "unClassified",
"value": "No category"
},
{
"name": "recentDeletes",
"value": "Recently deleted"
},
{
"name": "myFavorites",
"value": "My favourites"
},
{
"name": "create",
"value": "NEW"
},
{
"name": "createFolder",
"value": "New Folder"
},
{
"name": "editFolder",
"value": "Edit Folder"
},
{
"name": "deleteFolder",
"value": "Delete Folder"
},
{
"name": "createNote",
"value": "New note"
},
{
"name": "cancel",
"value": "CANCEL"
},
{
"name": "save",
"value": "SAVE"
},
{
"name": "delete",
"value": "DELETE"
},
{
"name": "name",
"value": "Name"
},
{
"name": "delete_tips",
"value": "Do you want to delete this folder and its contents?"
},
{
"name": "deleteNote",
"value": "Delete this note?"
},
{
"name": "deleteNoteComplete",
"value": "Permanently delete this note?"
},
{
"name": "deleteAllNote",
"value": "Delete all note?"
},
{
"name": "deletePartNote",
"value": "Delete %d notes?"
},
{
"name": "selected",
"value": "%d item selected"
},
{
"name": "none_selected",
"value": "None selected"
},
{
"name": "noteslist",
"value": "notes"
},
{
"name": "Empty_page",
"value": "No notes"
},
{
"name": "searchNote",
"value": "Search notes"
},
{
"name": "chooseFolder",
"value": "Select folder"
},
{
"name": "category_already_exist",
"value": "The folder name already exists."
},
{
"name": "input_placeholder",
"value": "Name"
},
{
"name": "permanently_delete_tips",
"value": "notes will be permanently deleted after the number of days shown (up to 30 days)."
},
{
"name": "set_top",
"value": "Top"
},
{
"name": "move",
"value": "Move"
},
{
"name": "recover",
"value": "Restore"
},
{
"name": "check_all",
"value": "Select all"
},
{
"name": "editNoteTitle",
"value": "Modify the title"
},
{
"name": "list",
"value": "Checklist"
},
{
"name": "style",
"value": "Style"
},
{
"name": "photo",
"value": "Gallery"
},
{
"name": "title",
"value": "Title"
},
{
"name": "empty_note",
"value": "The note content is empty."
},
{
"name": "restore",
"value": "Note Restored"
}
]
}
@@ -14,7 +14,7 @@
*/
html {
height: 100%;
height: 15%;
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
}
@@ -220,15 +220,14 @@ RICH_EDITOR.setBlockquote = function() {
document.execCommand('formatBlock', false, '<blockquote>');
}
RICH_EDITOR.insertImage = function() {
var url = './shuxue.png';
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)
}
RICH_EDITOR.insertHTML = function(html) {
RICH_EDITOR.restorerange();
document.execCommand('insertHTML', false, html);
}
@@ -303,4 +302,11 @@ function save_html_content() {
var htmlString = encodeURI(RICH_EDITOR.getHtml())
var str = callBackToApp.callbackhtmlSave(htmlString)
console.log('hhh objName.test result:' + str);
}
function scheduled_save_content() {
console.info('scheduled_save_content')
var htmlString = encodeURI(RICH_EDITOR.getHtml())
var str = callBackToApp.callbackScheduledSave(htmlString)
console.info('scheduled_save_content end')
}
@@ -135,6 +135,34 @@
{
"name": "check_all",
"value": "多选"
},
{
"name": "editNoteTitle",
"value": "修改标题"
},
{
"name": "list",
"value": "清单"
},
{
"name": "style",
"value": "样式"
},
{
"name": "photo",
"value": "相册"
},
{
"name": "title",
"value": "标题"
},
{
"name": "empty_note",
"value": "笔记内容为空"
},
{
"name": "restore",
"value": "已恢复"
}
]
}
+6 -18
View File
@@ -71,27 +71,15 @@
"reqPermissions": [
{
"name": "ohos.permission.READ_MEDIA",
"reason": "This is used to access photos and videos"
},
{
"name": "ohos.permission.WRITE_MEDIA",
"reason": "This is used to access photos and videos."
},
{
"name": "ohos.permission.WRITE_EXTERNAL_MEDIA_MEMORY",
"reason": "This is used to access photos and videos."
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "This is used to access photos and videos."
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "reques permission"
"reason": "$string:per_read_media"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "reques permission"
"reason": "$string:per_get_bundleInfo"
},
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "$string:per_dis_dataSync"
}
]
}
@@ -1,18 +1,3 @@
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
@@ -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
@@ -15,6 +15,7 @@
import Ability from '@ohos.application.Ability'
import {WebViewUtil} from './WebViewUtil.ets'
import fileio from '@ohos.fileio'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
@@ -32,6 +33,9 @@ export default class MainAbility extends Ability {
AppStorage.SetOrCreate<number>('IsContinue', 1)
this.context.restoreWindowStage(null)
}
AppStorage.SetOrCreate<number>('openPhoto', 0)
AppStorage.SetOrCreate<number>('openPerm', 0)
globalThis.noteContext = this.context
}
onDestroy() {
@@ -63,33 +67,4 @@ export default class MainAbility extends Ability {
})
console.log("MainAbility controllerShow end")
}
onContinue(wantParam: { [key: string]: any }) {
console.log("MainAbility onContinue")
// 获取本端的迁移数据
let continueFolder = AppStorage.Get<string>('ContinueFolder')
if (continueFolder == undefined || continueFolder == null) {
console.log("MainAbility onContinue, continue first folder")
continueFolder = JSON.stringify(AppStorage.Get('AllFolderArray')[0].toFolderObject())
}
let continueNote = AppStorage.Get<string>('ContinueNote')
if (continueNote == undefined || continueNote == null) {
console.log("MainAbility onContinue, continue first note")
continueNote = JSON.stringify(AppStorage.Get('AllNoteArray')[0].toNoteObject())
}
let continueSection = AppStorage.Get<number>('ContinueSection')
if (continueSection == undefined || continueSection == null) {
console.log("MainAbility onContinue, continue section 3")
continueSection = 3
}
// 保存本端的迁移数据
wantParam["ContinueFolder"] = continueFolder
wantParam["ContinueNote"] = continueNote
wantParam["ContinueSection"] = continueSection
return true
}
}
}
@@ -25,7 +25,7 @@ export class WebViewUtil {
public static getWebController(): WebController{
console.info('WebViewUtil, getWebController')
if (!this.controllerShow) {
if (!this.controllerShow && AppStorage.Get('openPhoto') == 0 && AppStorage.Get('openPerm') == 0) {
console.info('WebViewUtil, controllerShow is null')
this.controllerShow = new WebController()
}
@@ -1,4 +1,19 @@
import LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
const TAG = "NoteApp"
@@ -14,9 +14,11 @@
*/
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 {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
@Entry
@@ -28,7 +30,7 @@ export struct MyNoteHomeComp {
TAG = "MyNoteHomeComp"
build() {
Flex() {
Row() {
if (this.dBQueryFinished == 1) {
if (this.portraitModel == true) {
NoteHomePortraitComp()
@@ -45,19 +47,54 @@ export struct MyNoteHomeComp {
LogUtil.info(this.TAG, "aboutToAppear")
if (this.context == undefined || this.context == null) {
LogUtil.error(this.TAG, "context is error")
LogUtil.warn(this.TAG, "context is error")
return
}
LogUtil.info(this.TAG, "databaseDir is " + this.context.databaseDir)
// /data/storage/el2/database/tablet
let dbPath = "/data/app/el2/100/database/com.ohos.note/tablet/db/note.db"
try {
if (fileio.accessSync(dbPath) == undefined) {
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
let permissionList: Array<string> = [
"ohos.permission.READ_MEDIA",
"ohos.permission.DISTRIBUTED_DATASYNC"
]
bundle.getApplicationInfo('com.ohos.note', 0, 100).then((appInfo) => {
let tokenId = appInfo.accessTokenId
let statusPromise: Array<Promise<number>> = []
let requestList: Array<string> = []
let atManager = abilityAccessCtrl.createAtManager()
for (let i = 0; i < permissionList.length; i++) {
statusPromise.push(atManager.verifyAccessToken(tokenId, permissionList[i]))
}
Promise.all(statusPromise).then((status) => {
for (let i = 0; i < status.length; i++) {
if (status[i] == abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
requestList.push(permissionList[i])
}
}
if (requestList.length != 0) {
AppStorage.SetOrCreate<number>('openPerm', 1)
LogUtil.info(this.TAG, 'permissions need to require from user: ' + requestList)
this.context.requestPermissionsFromUser(requestList).then((data) => {
LogUtil.info(this.TAG, 'data permissions : ' + data.permissions)
LogUtil.info(this.TAG, 'data result: ' + data.authResults)
let sum = 0
for (let i = 0; i < data.authResults.length; i++) {
sum += data.authResults[i]
}
LogUtil.info(this.TAG, 'request permissions sum: ' + sum)
AppStorage.SetOrCreate<number>('openPerm', 0)
}, (err) => {
LogUtil.warn(this.TAG, 'failed to requestPermissionsFromUser : ' + err.code);
});
} else {
LogUtil.info(this.TAG, 'check all permissions are granted.')
}
})
})
let dbPath = this.context.databaseDir + "/db/note.db"
try {
fileio.accessSync(dbPath)
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
} catch (err) {
LogUtil.info(this.TAG, "db has not created, start to create db")
RdbStoreUtil.createRdbStore(this.context)
@@ -17,7 +17,7 @@ import {FolderListComp} from '../../../../../../../common/component/src/main/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 {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'
@@ -25,6 +25,7 @@ import {SysDefFolderUuid} from '../../../../../../../common/utils/src/main/ets/d
import LayoutUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets'
import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import {WebViewUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets'
import mediaquery from '@ohos.mediaquery'
@Entry
@Component
@@ -34,7 +35,7 @@ export struct NoteHomeComp {
@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')
@@ -52,6 +53,13 @@ export struct NoteHomeComp {
TAG = "NoteHomeComp"
narrowWinListener = mediaquery.matchMediaSync('(width < 2000)')
onWinSizeChange(mediaQueryResult) {
if (this.sectionStatus != 1) {
this.sectionStatus = (mediaQueryResult.matches) ? 2 : 3
}
}
build() {
Flex({ justifyContent: FlexAlign.Start }) {
// Folder list display area
@@ -60,47 +68,44 @@ export struct NoteHomeComp {
}
.flexShrink(0)
.backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5"))
.width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).folderListWeight)
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.folderListVisibility == 0 ? Visibility.None : Visibility.Visible)
.opacity(this.search ? StyleConstants.OPACITY_40 : StyleConstants.OPACITY_100)
.enabled(this.search ? false : true)
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
// Note list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteListComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteListWeight)
.layoutWeight(2)
.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 }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteContentComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor(this.search && this.inputKeyword.length == 0 ? $r("app.color.notecontent_color_000000") : $r("app.color.notecontent_color_ffffff"))
.width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight)
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.layoutWeight(this.sectionStatus != 1 ? 3 : null)
.height(StyleConstants.PERCENTAGE_100)
.opacity(this.longpress ? StyleConstants.OPACITY_40 : this.search && this.inputKeyword.length == 0 ? StyleConstants.OPACITY_20 : StyleConstants.OPACITY_100)
.enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true)
}
.width(StyleConstants.PERCENTAGE_100)
@@ -109,6 +114,8 @@ export struct NoteHomeComp {
aboutToAppear(): void{
LogUtil.info(this.TAG, "aboutToAppear")
this.narrowWinListener.on('change', this.onWinSizeChange.bind(this))
this.sectionStatus = this.narrowWinListener.matches ? 2 : 3
}
aboutToDisappear(): void{
@@ -17,7 +17,7 @@ import {FolderListComp} from '../../../../../../../common/component/src/main/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 {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'
@@ -30,7 +30,7 @@ export struct NoteHomePortraitComp {
@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')
@@ -102,7 +102,7 @@
},
{
"name": "searchNote",
"value": "搜索笔记"
"value": "搜索笔记..."
},
{
"name": "chooseFolder",
@@ -163,6 +163,18 @@
{
"name": "restore",
"value": "已恢复"
},
{
"name": "per_read_media",
"value": "是否允许备忘录访问媒体资源"
},
{
"name": "per_get_bundleInfo",
"value": "是否允许备忘录打开图库资源"
},
{
"name": "per_dis_dataSync",
"value": "是否允许备忘录流转到其它设备"
}
]
}
@@ -3,7 +3,7 @@
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 18 18" style="enable-background:new 0 0 18 18;" xml:space="preserve">
<style type="text/css">
.st0{fill:#007DFF;}
.st0{fill:#F86D05;}
</style>
<title>搜索</title>
<path class="st0" d="M13.2,12.2l2.4,2.4c0.3,0.3,0.3,0.8,0,1.1s-0.8,0.3-1.1,0l-2.4-2.4C12.5,13,12.9,12.6,13.2,12.2z M7.8,1.5

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 840 B

@@ -0,0 +1,168 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "Notepad"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "note",
"value": "Notes"
},
{
"name": "allNotes",
"value": "All notes"
},
{
"name": "unClassified",
"value": "No category"
},
{
"name": "recentDeletes",
"value": "Recently deleted"
},
{
"name": "myFavorites",
"value": "My favourites"
},
{
"name": "create",
"value": "NEW"
},
{
"name": "createFolder",
"value": "New Folder"
},
{
"name": "editFolder",
"value": "Edit Folder"
},
{
"name": "deleteFolder",
"value": "Delete Folder"
},
{
"name": "createNote",
"value": "New note"
},
{
"name": "cancel",
"value": "CANCEL"
},
{
"name": "save",
"value": "SAVE"
},
{
"name": "delete",
"value": "DELETE"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "Do you want to delete this folder and its contents?"
},
{
"name": "deleteNote",
"value": "Delete this note?"
},
{
"name": "deleteNoteComplete",
"value": "Permanently delete this note?"
},
{
"name": "deleteAllNote",
"value": "Delete all note?"
},
{
"name": "deletePartNote",
"value": "Delete %d notes?"
},
{
"name": "selected",
"value": "%d item selected"
},
{
"name": "none_selected",
"value": "None selected"
},
{
"name": "noteslist",
"value": "notes"
},
{
"name": "Empty_page",
"value": "No notes"
},
{
"name": "searchNote",
"value": "Search notes"
},
{
"name": "chooseFolder",
"value": "Select folder"
},
{
"name": "category_already_exist",
"value": "The folder name already exists."
},
{
"name": "input_placeholder",
"value": "Name"
},
{
"name": "permanently_delete_tips",
"value": "notes will be permanently deleted after the number of days shown (up to 30 days)."
},
{
"name": "set_top",
"value": "Top"
},
{
"name": "move",
"value": "Move"
},
{
"name": "recover",
"value": "Restore"
},
{
"name": "check_all",
"value": "Select all"
},
{
"name": "editNoteTitle",
"value": "Modify the title"
},
{
"name": "list",
"value": "Checklist"
},
{
"name": "style",
"value": "Style"
},
{
"name": "photo",
"value": "Gallery"
},
{
"name": "title",
"value": "Title"
},
{
"name": "empty_note",
"value": "The note content is empty."
},
{
"name": "restore",
"value": "Note Restored"
}
]
}
@@ -14,7 +14,7 @@
*/
html {
height: 100%;
height: 15%;
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
}
@@ -220,15 +220,14 @@ RICH_EDITOR.setBlockquote = function() {
document.execCommand('formatBlock', false, '<blockquote>');
}
RICH_EDITOR.insertImage = function() {
var url = './shuxue.png';
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)
}
RICH_EDITOR.insertHTML = function(html) {
RICH_EDITOR.restorerange();
document.execCommand('insertHTML', false, html);
}
@@ -303,4 +302,11 @@ function save_html_content() {
var htmlString = encodeURI(RICH_EDITOR.getHtml())
var str = callBackToApp.callbackhtmlSave(htmlString)
console.log('hhh objName.test result:' + str);
}
function scheduled_save_content() {
console.info('scheduled_save_content')
var htmlString = encodeURI(RICH_EDITOR.getHtml())
var str = callBackToApp.callbackScheduledSave(htmlString)
console.info('scheduled_save_content end')
}
@@ -0,0 +1,168 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "备忘录"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "note",
"value": "笔记"
},
{
"name": "allNotes",
"value": "全部笔记"
},
{
"name": "unClassified",
"value": "未分类"
},
{
"name": "recentDeletes",
"value": "最近删除"
},
{
"name": "myFavorites",
"value": "我的收藏"
},
{
"name": "create",
"value": "新建"
},
{
"name": "createFolder",
"value": "新建文件夹"
},
{
"name": "editFolder",
"value": "编辑文件夹"
},
{
"name": "deleteFolder",
"value": "删除文件夹"
},
{
"name": "createNote",
"value": "新建笔记"
},
{
"name": "cancel",
"value": "取消"
},
{
"name": "save",
"value": "保存"
},
{
"name": "delete",
"value": "删除"
},
{
"name": "name",
"value": "名称"
},
{
"name": "delete_tips",
"value": "是否删除此文件夹及其中的内容?"
},
{
"name": "deleteNote",
"value": "是否删除此笔记?"
},
{
"name": "deleteNoteComplete",
"value": "此笔记将被永久删除,无法恢复。是否删除?"
},
{
"name": "deleteAllNote",
"value": "是否删除全部笔记?"
},
{
"name": "deletePartNote",
"value": "是否删除%d条笔记?"
},
{
"name": "selected",
"value": "已选择%d项"
},
{
"name": "none_selected",
"value": "未选择"
},
{
"name": "noteslist",
"value": "条笔记"
},
{
"name": "Empty_page",
"value": "没有笔记"
},
{
"name": "searchNote",
"value": "搜索笔记..."
},
{
"name": "chooseFolder",
"value": "请选择文件夹"
},
{
"name": "category_already_exist",
"value": "文件夹名称已存在"
},
{
"name": "input_placeholder",
"value": "名称"
},
{
"name": "permanently_delete_tips",
"value": "笔记删除前会显示剩余天数(最长30天),之后将永久删除"
},
{
"name": "set_top",
"value": "置顶"
},
{
"name": "move",
"value": "移到"
},
{
"name": "recover",
"value": "恢复"
},
{
"name": "check_all",
"value": "多选"
},
{
"name": "editNoteTitle",
"value": "修改标题"
},
{
"name": "list",
"value": "清单"
},
{
"name": "style",
"value": "样式"
},
{
"name": "photo",
"value": "相册"
},
{
"name": "title",
"value": "标题"
},
{
"name": "empty_note",
"value": "笔记内容为空"
},
{
"name": "restore",
"value": "已恢复"
}
]
}
Binary file not shown.