!51 adapt project structure for API9

Merge pull request !51 from guozejun/OpenHarmony-3.1-Release
This commit is contained in:
openharmony_ci
2022-05-23 01:38:43 +00:00
committed by Gitee
271 changed files with 5274 additions and 1905 deletions
+4 -15
View File
@@ -1,16 +1,5 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
/node_modules
/local.properties
/.idea
**/build
/signature
+12 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -12,9 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
include ':phone', ':tablet', ':pc',':common:utils', ':common:component'
project(':tablet').projectDir = new File('./product/tablet')
project(':phone').projectDir = new File('./product/phone')
project(':pc').projectDir = new File('./product/pc')
{
"app": {
"bundleName": "com.ohos.note",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true
}
}
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "ohos_note"
}
]
}

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

+1 -1
View File
@@ -173,4 +173,4 @@ Apache License
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
+64
View File
@@ -0,0 +1,64 @@
/*
* 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.
*/
{
"app": {
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
}
]
},
"modules": [
{
"name": "phone",
"srcPath": "./product/phone",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "tablet",
"srcPath": "./product/tablet",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "utils",
"srcPath": "./common/utils"
},
{
"name": "component",
"srcPath": "./common/component"
},
{
"name": "resources",
"srcPath": "./common/resources"
}
]
}
-38
View File
@@ -1,38 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.huawei.ohos.app'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 8
supportSystem "standard"
}
buildscript {
repositories {
maven {
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
allowInsecureProtocol = true
}
maven {
url 'http://mirrors.tools.huawei.com/maven/'
allowInsecureProtocol = true
}
}
dependencies {
classpath 'com.huawei.ohos:hap:3.0.6.4'
classpath 'com.huawei.ohos:decctest:1.2.7.2'
}
}
allprojects {
repositories {
maven {
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
allowInsecureProtocol = true
}
maven {
url 'http://mirrors.tools.huawei.com/maven/'
allowInsecureProtocol = true
}
}
}
+3
View File
@@ -0,0 +1,3 @@
/node_modules
/.preview
/build
+20
View File
@@ -0,0 +1,20 @@
/*
* 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.
*/
{
"apiType": "stageMode",
"buildOption": {
}
}
-20
View File
@@ -1,20 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 8
defaultConfig {
compatibleSdkVersion 8
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
}
+3
View File
@@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks
+21
View File
@@ -0,0 +1,21 @@
/*
* 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.
*/
export * from './src/main/ets/components/CusDialogComp';
export * from './src/main/ets/components/FolderListComp';
export * from './src/main/ets/components/NoteContent';
export { ToolBarComp, NoteContentComp, NoteContentOverViewComp } from './src/main/ets/components/NoteContentComp';
export { NoteContentCompPortrait } from './src/main/ets/components/NoteContentCompPortrait';
export * from './src/main/ets/components/NoteListComp';
+22
View File
@@ -0,0 +1,22 @@
{
"name": "@ohos/component",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/source": {
"version": "file:../resources"
},
"@ohos/utils": {
"version": "file:../utils",
"requires": {
"@ohos/source": "file:../resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../resources"
}
}
}
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"license":"ISC",
"types":"",
"devDependencies":{},
"name":"@ohos/component",
"description":"a npm package which contains arkUI2.0 page",
"ohos":{
"org":""
},
"main":"index.ets",
"repository":{},
"version":"1.0.0",
"dependencies":{
"@ohos/utils":"file:../utils",
"@ohos/source":"file:../resources"
}
}
-1
View File
@@ -1 +0,0 @@
# config module specific ProGuard rules here.
-22
View File
@@ -1,22 +0,0 @@
{
"app": {
"bundleName": "com.ohos.note",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.note.common",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "component",
"moduleType": "har"
}
}
}
@@ -13,14 +13,14 @@
* limitations under the License.
*/
import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets'
import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets'
import {circleColorArray, fontColorArray} from '../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets'
import {SysDefFolderUuid, DeleteFileType, FolderType} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets'
import GlobalResourceManager from '../../../../../../common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import GlobalResourceManager from '@ohos/utils/src/main/ets/default/baseUtil/GlobalResourceManager'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import { circleColorArray, fontColorArray, SysDefFolderUuid, DeleteFileType, FolderType, LogUtil } from '@ohos/utils'
const TAG = "CusDialogComp"
const TAG = "CusDialogComp"
@CustomDialog
@@ -51,16 +51,17 @@ export struct NewOrEditFolderDialog {
// folder name input
Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.folder"))
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.objectFit(ImageFit.ScaleDown)
.flexShrink(0)
.fillColor(this.selectedColor)
TextInput({ text: this.inputName, placeholder: $r("app.string.input_placeholder") })
.placeholderFont({ size: 18 })
.maxLength(20)
.borderRadius(15)
.backgroundColor($r("app.color.New_folder_input_box_color"))
.width('90%')
.width('100%')
.onChange((value: string) => {
this.inputName = value
FolderUtil.duplicateDetection(this.inputName, this.AllFolderArray).then(result => {
@@ -69,15 +70,17 @@ export struct NewOrEditFolderDialog {
})
}.margin({ bottom: 4, left: 24, right: 24 })
Text($r("app.string.category_already_exist"))
.fontSize(10)
.margin({ left: 64 })
.fontColor($r("app.color.category_already_exist_font_color"))
.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"))
.color((this.isExisted && this.inputName != this.oriInputName) ? $r("app.color.category_already_exist_divider_color") : $r("app.color.divider_color_182431"))
Text($r("app.string.category_already_exist"))
.fontSize(10)
.margin({ left: 64, top: 4 })
.fontColor($r("app.color.category_already_exist_font_color"))
.visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None)
// button group
Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) {
Text($r("app.string.cancel"))
@@ -253,14 +256,16 @@ struct NoteDataMoveItemComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
private folderItem: FolderData
dividerShow: boolean = true
build() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
.objectFit(ImageFit.ScaleDown)
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.flexShrink(0)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
}
.width(24)
@@ -273,18 +278,23 @@ struct NoteDataMoveItemComp {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.flexShrink(1)
.fontWeight(FontWeight.Medium)
Image((FolderUtil.getCommonFolder(this.AllFolderArray, this.CheckedNoteArray) == null
|| FolderUtil.getCommonFolder(this.AllFolderArray, this.CheckedNoteArray) != this.folderItem) ? $r("app.media.foldMove_unselect") : $r("app.media.foldMove_select"))
.objectFit(ImageFit.ScaleDown)
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.flexShrink(0)
}
.width(248)
.height(55)
Divider()
.color($r("app.color.divider_color_e4e4e4"))
.strokeWidth(1)
if (this.dividerShow) {
Divider()
.color($r("app.color.divider_color_e4e4e4"))
.strokeWidth(1)
}
}
.padding({ left: 16 })
}
@@ -298,18 +308,26 @@ struct NoteDataMoveItemComp {
export struct NoteDataMoveDialog {
noteDataMoveDialogCtl: CustomDialogController
onConfirm: (folderUuid: string) => void
NoteDataMoveArray: FolderData[]
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
aboutToAppear() {
this.NoteDataMoveArray = this.AllFolderArray.slice(2, this.AllFolderArray.length);
this.NoteDataMoveArray.push(this.AllFolderArray[1]);
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Flex({ alignItems: ItemAlign.Center }) {
Text($r("app.string.chooseFolder"))
.fontSize(20)
.fontWeight(600)
.fontWeight(FontWeight.Medium)
}.height(56)
.width(288)
List() {
ForEach(this.AllFolderArray, (item) => {
ForEach(this.NoteDataMoveArray.slice(0, this.NoteDataMoveArray.length - 1), (item) => {
ListItem() {
NoteDataMoveItemComp({ folderItem: item })
}
@@ -318,6 +336,13 @@ export struct NoteDataMoveDialog {
this.onConfirm(item.uuid)
})
}, noteItem => noteItem.uuid)
ListItem() {
NoteDataMoveItemComp({ folderItem: this.NoteDataMoveArray[this.NoteDataMoveArray.length - 1], dividerShow: false })
}
.onClick(() => {
this.noteDataMoveDialogCtl.close()
this.onConfirm(this.NoteDataMoveArray[this.NoteDataMoveArray.length - 1].uuid)
})
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
@@ -325,7 +350,7 @@ export struct NoteDataMoveDialog {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text($r("app.string.cancel"))
.fontSize(16)
.fontColor($r("app.color.text_color_3f97e9"))
.fontColor($r("app.color.button_color_f86d05"))
.onClick(() => {
this.noteDataMoveDialogCtl.close()
})
@@ -341,15 +366,18 @@ export struct NoteDataMoveDialog {
}
}
let inSetValue = AppStorage.Link('inSetValue')
@CustomDialog
export struct EditContentDialog {
editContentDialogCtl: CustomDialogController
confirm: (excuteJs: string) => void
@Consume('SelectedColor') selectedColor: string
@State inSetValue: number = 20
@State selectFontColor: string = fontColorArray[0]
@StorageLink("inSetValue") inSetValue: number = 4
private circleColor: string
private fontSize: number
aboutToAppear(){
this.confirm("javascript:RICH_EDITOR.getFontSizes()")
}
build() {
Row() {
Column() {
@@ -451,6 +479,7 @@ export struct EditContentDialog {
Image($r('app.media.suojin_back'))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setOutdent()")
})
@@ -541,10 +570,10 @@ export struct EditContentDialog {
.fill(colorStr)
Circle({ width: 12, height: 12 })
.fill($r("app.color.color_ffffff"))
.visibility(colorStr == this.selectedColor ? Visibility.Visible : Visibility.None)
.visibility(colorStr == this.selectFontColor ? Visibility.Visible : Visibility.None)
}.onClick(() => {
this.selectedColor = colorStr
this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectedColor + "')")
this.selectFontColor = colorStr
this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectFontColor + "')")
})
}, colorStr => colorStr)
}.padding({ bottom: 11 })
@@ -564,8 +593,8 @@ export struct EditContentDialog {
Slider({
value: this.inSetValue,
min: 0,
max: 60,
step: 10,
max: 16,
step: 4,
style: SliderStyle.InSet
})
.blockColor($r("app.color.color_ffffff"))
@@ -574,8 +603,8 @@ export struct EditContentDialog {
.showSteps(false)
.showTips(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.inSetValue = value
this.fontSize = value + 20
AppStorage.Set<number>('inSetValue', value)
this.fontSize = value + 12
this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')")
LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString())
})
@@ -668,13 +697,11 @@ export struct EditTitleDialog {
export struct EditContentDialogPortrait {
editContentDialogCtl: CustomDialogController;
confirm: (excuteJs: string) => void
@Consume('SelectedColor') selectedColor: string;
@State selectFontColor: string = fontColorArray[0]
@State inSetValue: number = 20
private circleColor: string
private fontSize: number
build() {
Column() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
@@ -682,7 +709,7 @@ export struct EditContentDialogPortrait {
Text($r("app.string.style")).margin({ top: 8 })
.fontSize(14).fontColor($r("app.color.font_stylecolor_AD182431"))
Image($r('app.media.cross')).height(16).width(16).margin({ top: 8 })
Image($r('app.media.cross')).height(16).width(16).margin({ top: 8 }).fillColor($r("app.color.font_stylecolor_AD182431"))
.onClick(() => {
this.editContentDialogCtl.close()
})
@@ -786,6 +813,7 @@ export struct EditContentDialogPortrait {
Image($r('app.media.suojin_back'))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.confirm("javascript:RICH_EDITOR.setOutdent()")
})
@@ -852,10 +880,10 @@ export struct EditContentDialogPortrait {
Stack({ alignContent: Alignment.Center }) {
Circle({ width: 24, height: 24 }).fill(colorStr)
Circle({ width: 12, height: 12 }).fill($r("app.color.color_ffffff"))
.visibility(colorStr == this.selectedColor ? Visibility.Visible : Visibility.None)
.visibility(colorStr == this.selectFontColor ? Visibility.Visible : Visibility.None)
}.onClick(() => {
this.selectedColor = colorStr
this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectedColor + "')")
this.selectFontColor = colorStr
this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectFontColor + "')")
})
}, colorStr => colorStr)
}
@@ -870,8 +898,8 @@ export struct EditContentDialogPortrait {
Slider({
value: this.inSetValue,
min: 0,
max: 60,
step: 10,
max: 16,
step: 4,
style: SliderStyle.InSet
})
.blockColor($r("app.color.color_ffffff"))
@@ -881,7 +909,7 @@ export struct EditContentDialogPortrait {
.showTips(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.inSetValue = value
this.fontSize = value + 20
this.fontSize = value + 12
this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')")
LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString())
})
@@ -13,15 +13,15 @@
* limitations under the License.
*/
import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets'
import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets'
import {SysDefFolderUuid, TableName, FolderType, FolderTableColumn, NoteTableColumn, Delete, DeleteFileType} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets'
import {NewOrEditFolderDialog, DeleteDialog} from './CusDialogComp.ets'
import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets'
import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import {SysDefFolderUuid, TableName, FolderType, FolderTableColumn, NoteTableColumn, Delete, DeleteFileType} from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import {NewOrEditFolderDialog, DeleteDialog} from './CusDialogComp'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
// Folder list component
@Component
@@ -33,41 +33,43 @@ export struct FolderListComp {
TAG = "FolderListComp"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Flex({direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween}) {
Column() {
Image($r("app.media.suojin"))
.height(24)
.width(24)
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
AppStorage.SetOrCreate('ContinueExpand', 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 })
Column() {
Image($r("app.media.suojin"))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
if (this.sectionStatus == 1) {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// save continue data
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()
// center
List() {
ForEach(this.AllFolderArray, (folderItem: FolderData) => {
ListItem() {
if (!FolderUtil.isBottomFixedFolder(folderItem)) {
FolderItemComp({ folderItem: folderItem, controllerShow: this.controllerShow })
List() {
ForEach(this.AllFolderArray, (folderItem: FolderData) => {
ListItem() {
if (!FolderUtil.isBottomFixedFolder(folderItem)) {
FolderItemComp({ folderItem: folderItem, controllerShow: this.controllerShow })
}
}
}
}, folderItem => folderItem.name.toString())
}.width('100%')
.padding({ left: 12, right: 12 })
Blank()
}, folderItem => folderItem.name.toString())
}.width('100%')
.padding({ left: 12, right: 12 })
}
Column() {
FolderItemComp({
folderItem: FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), SysDefFolderUuid.MyFavorites),
@@ -81,7 +83,7 @@ export struct FolderListComp {
.width("100%")
.padding({ left: 12, right: 12 })
}
.padding({ bottom: 48 })
.padding({ bottom: 24 })
.height("100%")
}
@@ -92,7 +94,6 @@ export struct FolderListComp {
aboutToDisappear(): void{
LogUtil.info(this.TAG, "aboutToDisappear")
}
}
@Component
@@ -326,12 +327,13 @@ struct FolderItemComp {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Row() {
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
.objectFit(ImageFit.ScaleDown)
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid))
.margin({ right: 16 })
Text(FolderUtil.getFolderText(this.folderItem))
.fontWeight(FontWeight.Medium)
.fontSize(16)
.textAlign(TextAlign.Center)
.maxLines(1)
@@ -343,6 +345,7 @@ struct FolderItemComp {
}.width(118)
Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.folderItem.uuid).toString())
.fontWeight(FontWeight.Regular)
.fontSize(14)
.textAlign(TextAlign.Center)
}
@@ -351,7 +354,7 @@ struct FolderItemComp {
.height(56)
.padding({ left: 12, right: 12 })
.backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") : this.selectedFolderData.uuid == this.folderItem.uuid
? $r("app.color.folder_color_ffffff") : $r("app.color.folder_color_19ffffff"))
? $r("app.color.folder_color_ffffff") : "")
.bindContextMenu(this.menuBuilder, ResponseType.LongPress)
.bindContextMenu(this.menuBuilder, ResponseType.RightClick)
.onClick(() => {
@@ -362,7 +365,11 @@ struct FolderItemComp {
this.selectedFolderData = this.folderItem
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.folderItem.uuid)
// 刷新web界面
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
if (this.portraitModel == false) {
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)
@@ -387,4 +394,21 @@ struct FolderItemComp {
)
)
}
}
@Component
export struct FolderListBackGround {
build() {
Column() { }
.shadow({
radius: 54,
offsetY: 24
})
.width("100%")
.height("100%")
.backgroundColor($r('app.color.folder_color_d6d6d6'))
.opacity(0.4)
.blur(60)
}
}
@@ -0,0 +1,449 @@
/*
* 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 DateUtil from '@ohos/utils/src/main/ets/default/baseUtil/DateUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete
} from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import {EditContentDialog, DeleteDialog, EditTitleDialog} from './CusDialogComp'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import prompt from '@system.prompt'
import featureAbility from '@ohos.ability.featureAbility'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import OperationUtils from '@ohos/utils/src/main/ets/default/baseUtil/OperationUtils'
import mediaquery from '@ohos.mediaquery'
import router from '@system.router';
import inputMethod from '@ohos.inputmethod';
const TAG = "NoteContent"
var timeID: number
@Component
export struct NoteContent {
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote')
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Provide('Issave') issave: number = 0
@Provide('EditModel') editModel: boolean = false
controllerShow: WebController
private editContentFlag = false
noteContent = {
callbackhtml: (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)
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.uuid)
AppStorage.SetOrCreate<NoteData>('NewNote', this.selectedNoteData)
AppStorage.SetOrCreate<boolean>('needRefresh',true)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "callbackhtml, set continue note success")
},
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)
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())
LogUtil.info(TAG, 'continueNote content', continueNote)
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, 'callbackScheduledSave, set continue note success')
}
}
build() {
Stack({ alignContent: Alignment.Bottom }) {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
Column() {
ToolBarComp({ controllerShow: this.controllerShow })
}.margin({ left: 24, right: 24 })
Column() {
NoteContentOverViewComp()
Web({ src: $rawfile('editor.html'), controller: this.controllerShow })
.javaScriptAccess(true)
.onPageEnd((e) => {
if (this.editContentFlag == false) {
this.controllerShow.registerJavaScriptProxy({
object: this.noteContent,
name: "callBackToApp", // html--> name.method
methodList: ["callbackhtml", "callbackScheduledSave"],
})
LogUtil.info(TAG, "finish register")
this.controllerShow.refresh()
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
})
.zoomAccess(false)
.height('70%')
.width('100%')
}
.margin({ left: 12, right: 24, top: 16 })
.width(StyleConstants.PERCENTAGE_100)
.onClick(() => {
// 添加定时器:3s自动保存
timeID = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduled_save_content()" })
}, 3000)
LogUtil.info(TAG, "setInterval timeID : " + timeID)
this.issave = 0
this.editModel = true
})
}
.height(StyleConstants.PERCENTAGE_100)
}
.height(StyleConstants.PERCENTAGE_100)
.width(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void{
LogUtil.info(TAG, "aboutToAppear")
}
aboutToDisappear(): void{
LogUtil.info(TAG, "aboutToDisappear")
}
}
@Component
export struct ToolBarComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('Issave') issave: number
@Consume('EditModel') editModel: boolean
controllerShow: WebController
editContentDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditContentDialog({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Bottom,
autoCancel: true,
customStyle: true,
})
confirm(excuteJs: string) {
this.controllerShow.runJavaScript({ script: excuteJs })
}
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image($r('app.media.narrow'))
.height(24)
.width(24)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({ script: "get_html_content()" })
// 清除定时器
if (timeID != undefined) {
LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID)
clearInterval(timeID)
}
router.back()
})
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
if (this.editModel == false) {
Row({ space: StyleConstants.SPACE_24 }) {
Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') : $r('app.media.favorite_cancel'))
.height(24).width(24)
.onClick(() => {
this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes)
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
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_6 }) {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.circle_tick1'))
.height(24)
.width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
// 清单
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.font_style'))
.height(24)
.width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
LogUtil.info(TAG, 'editContentDialogCtl start')
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)
.onClick(async () => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
LogUtil.info(TAG, 'startAbility start')
await globalThis.noteContext.startAbilityForResult({
parameters: { uri: "singleselect" },
bundleName: "com.ohos.photos",
abilityName: "com.ohos.photos.MainAbility",
})
.then(v => {
let want = v['want'];
if (want != null && want != undefined) {
let param = want['parameters'];
let imageUri = ""
if (param != null && param != undefined) {
let uri = param['select-item-list'];
imageUri = uri;
}
// 拷贝
if(imageUri != null && imageUri != "") {
OperationUtils.copy(imageUri).then((uriPath) => {
var path = "file://" + uriPath
LogUtil.info(TAG, 'image uri is:' + path)
this.controllerShow.runJavaScript({script:"javascript:RICH_EDITOR.insertImage('" + path + "')"})
})
}
}
});
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.undo'))
.height(24)
.width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
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(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
this.controllerShow.runJavaScript({ script: "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_thick'))
.height(24)
.width(24)
.fillColor(this.issave == 0 ? Color.Black : Color.Grey)
.onClick(() => {
this.issave = 1
// 保存笔记信息到数据库
this.controllerShow.runJavaScript({ script: "get_html_content()" })
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
}.width(274)
}
}
.width(StyleConstants.PERCENTAGE_100)
.height(80)
}
}
@Component
export struct NoteContentOverViewComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditTitleDialog({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "NoteContentOverViewComp confirm, set continue note success")
}
@Builder MenuBuilder() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
List() {
ForEach(this.AllFolderArray, (item) => {
ListItem() {
NoteDataMoveItemComp({ folderItem: item })
}
.onClick(() => {
this.selectedNoteData.folder_uuid = item.uuid
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "NoteContentOverViewComp MenuBuilder, set continue note success")
})
}, noteItem => noteItem.uuid)
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
}
.width(148)
.backgroundColor($r("app.color.color_fffffB"))
.padding({ left: 24, right: 24 })
}
build() {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Text(this.selectedNoteData.title)
.fontSize(30)
.margin({ left: 12, right: 24 })
.onClick(() => {
this.editTitleDialogCtl.open()
})
}.height(40)
.width(StyleConstants.PERCENTAGE_100)
Row() {
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
.fontSize(12)
.padding({ top: 4, bottom: 4 })
.fontColor($r("app.color.modified_time_font_color"))
.margin({ left: 12 })
Row() {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
.fontSize(12)
.fontColor($r("app.color.list_modified_time_font_color"))
Image($r('app.media.triangle'))
.width(6)
.height(12)
.margin({ left: 4 })
}
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
.margin({ left: 8 })
.borderRadius(16)
.backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid, SysDefFolderUuid.AllNotes, false))
.bindMenu(this.MenuBuilder)
}.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100)
}
.opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1)
.width(StyleConstants.PERCENTAGE_100)
.height(80)
}
}
@Component
struct NoteDataMoveItemComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
private folderItem: FolderData
build() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.flexShrink(0)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
}
.width(24)
Column() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text(FolderUtil.getFolderText(this.folderItem))
.fontSize(16)
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
.textAlign(TextAlign.Center)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.flexShrink(1)
}
.width('100%')
.height(55)
Divider()
.color($r("app.color.divider_color_e4e4e4"))
.strokeWidth(1)
}
.padding({ left: 16 })
}
.width('100%')
.height(56)
.visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None)
}
}
@@ -0,0 +1,620 @@
/*
* 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 DateUtil from '@ohos/utils/src/main/ets/default/baseUtil/DateUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete} from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import {EditContentDialog, DeleteDialog, EditTitleDialog} from './CusDialogComp'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import prompt from '@system.prompt'
import featureAbility from '@ohos.ability.featureAbility'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import OperationUtils from '@ohos/utils/src/main/ets/default/baseUtil/OperationUtils'
import mediaquery from '@ohos.mediaquery'
import inputMethod from '@ohos.inputmethod';
const TAG = "NoteContentComp"
var timeId : number
// Note content component
let inSetValue = AppStorage.Link('inSetValue')
@Component
export struct NoteContentComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('EditModel') editModel: boolean
@Consume('SectionStatus') sectionStatus: number
@Consume('LastSectionStatus') lastSectionStatus: number
@Consume('Issave') issave: number
controllerShow: WebController
private editContentFlag = false
@State uri1: string = ""
private context = getContext(this)
noteContent = {
callbackhtml: (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)
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.uuid)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "callbackhtml, set continue note success")
return "AceString"
},
callbackhtmlSave: (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)
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.uuid)
this.sectionStatus = this.lastSectionStatus
this.sectionStatus = mediaquery.matchMediaSync('(width < 2000)').matches ? 2 : 3
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "callbackhtmlSave, set continue note and section success")
return "AceString"
},
callbackScheduledSave: (html) => {
LogUtil.info(TAG, 'callbackScheduledSave')
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
// updata note image
this.selectedNoteData.content_img = RdbStoreUtil.updataNoteImage(this.selectedNoteData)
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')
},
callbackGetSize: (size) => {
if(size) {
AppStorage.Set<number>('inSetValue', parseInt(size.slice(0,-2)) - 12)
}
}
}
build() {
Stack({ alignContent: Alignment.Bottom }) {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
Column() {
ToolBarComp({ controllerShow: this.controllerShow })
}
.margin({ left: 24, right: 24 })
Column() {
NoteContentOverViewComp({ controllerShow: this.controllerShow })
Text(this.refreshFlag.toString()).visibility(Visibility.None)
Text(this.AllNoteArray.length.toString()).visibility(Visibility.None) // 用于强制刷新使用
Web({ src: $rawfile('editor.html'), controller: this.controllerShow })
.javaScriptAccess(true)
.onPageEnd((e) => {
if (this.editContentFlag == false) {
this.controllerShow.registerJavaScriptProxy({
object: this.noteContent,
name: "callBackToApp", // html--> name.method
methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave", "callbackGetSize"],
})
LogUtil.info(TAG, "finish register")
this.controllerShow.refresh()
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
// 初次加载为为小屏预览模式
if (this.sectionStatus != 1) {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
}
})
.zoomAccess(false)
.height('70%')
.width('100%')
}
.margin({ left: 12, right: 24, top: 16 })
.width(StyleConstants.PERCENTAGE_100)
.enabled(this.selectedNoteData && this.selectedNoteData.is_deleted == Delete.Yes ? false : true)
.onClick(() => {
this.issave = 0
LogUtil.info(TAG, "editModel : " + this.editModel + ", sectionStatus : " + this.sectionStatus)
let isContinue = AppStorage.Get<boolean>('IsContinue')
LogUtil.info(TAG, "isContinue : " + isContinue)
// 点击第三屏进入全屏编辑模式
if (this.sectionStatus != 1 || isContinue) {
this.lastSectionStatus = this.sectionStatus
this.sectionStatus = 1
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
// 添加定时器:3s自动保存
timeId = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduled_save_content()" })
}, 3000)
LogUtil.info(TAG, "setInterval timeId : " + timeId)
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "set continue section success")
this.editModel = !this.editModel
AppStorage.SetOrCreate<boolean>('IsContinue', false)
}
})
}
.height(StyleConstants.PERCENTAGE_100)
.visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible)
}
.height(StyleConstants.PERCENTAGE_100)
.width(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void{
LogUtil.info(TAG, "aboutToAppear")
}
aboutToDisappear(): void{
LogUtil.info(TAG, "aboutToDisappear")
}
}
@Component
export struct NoteContentOverViewComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('EditModel') editModel: boolean
@Consume('SectionStatus') sectionStatus: number
@Consume('RefreshFlag') refreshFlag: number
controllerShow: WebController
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditTitleDialog({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
}
@Builder MenuBuilder() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
List() {
ForEach(this.AllFolderArray, (item) => {
ListItem() {
NoteDataMoveItemComp({ folderItem: item })
}
.onClick(() => {
this.selectedNoteData.folder_uuid = item.uuid
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
if(this.sectionStatus != 1) {
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
} else {
this.selectedFolderData = FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), item.uuid)
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "NoteContentOverViewComp, MenuBuilder, set continue note success")
})
}, noteItem => noteItem.uuid)
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
}
.width(148)
.backgroundColor($r("app.color.color_fffffB"))
.padding({ left: 24, right: 24 })
}
build() {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Text(this.selectedNoteData.title)
.fontSize(30)
.margin({ left: 12, right: 24 })
.onClick(() => {
this.editModel = true
this.sectionStatus = 1
this.editTitleDialogCtl.open()
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "NoteContentComp, set continue section success")
})
}.height(40)
.width(StyleConstants.PERCENTAGE_100)
Row() {
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
.fontSize(12)
.padding({ top: 4, bottom: 4 })
.fontColor($r("app.color.modified_time_font_color"))
.margin({ left: 12 })
Row() {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
.fontSize(12)
.fontColor($r("app.color.list_modified_time_font_color"))
Image($r('app.media.triangle'))
.width(6)
.height(12)
.margin({ left: 4 })
}
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
.margin({ left: 8 })
.borderRadius(16)
.backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid, SysDefFolderUuid.AllNotes, false))
.bindMenu(this.MenuBuilder)
}.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100)
}
.opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1)
.width(StyleConstants.PERCENTAGE_100)
.height(80)
}
}
@Component
export struct ToolBarComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SectionStatus') sectionStatus: number
@Consume('LastSectionStatus') lastSectionStatus: number
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('ChooseNote') chooseNote: boolean
@Consume('PortraitModel') portraitModel: boolean
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('EditModel') editModel: boolean
@Consume('Issave') issave: number
controllerShow: WebController
private context = getContext(this)
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
onDeleteConfirm() {
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
this.selectedNoteData.is_deleted = Delete.Yes
this.selectedNoteData.deleted_time = new Date().getTime()
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
} else {
NoteUtil.removeNoteData(this.AllNoteArray, this.selectedNoteData.uuid)
// delete note from db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.delete(predicates_note, null)
}
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
this.chooseNote = false
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "NoteContentOverViewComp, set continue note success")
}
editContentDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditContentDialog({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Bottom,
autoCancel: true,
customStyle: true,
})
confirm(excuteJs: string) {
this.controllerShow.runJavaScript({ script: excuteJs })
}
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image(this.sectionStatus == 1 ? $r('app.media.narrow') : $r('app.media.zoom'))
.height(24)
.width(24)
.onClick(() => {
if (this.sectionStatus != 1) {
this.lastSectionStatus = this.sectionStatus
this.sectionStatus = 1
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
} else {
if (this.lastSectionStatus != undefined) {
// 切换为小屏预览模式
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.sectionStatus = this.lastSectionStatus
// 退出全屏时存库
LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid)
this.controllerShow.runJavaScript({ script: "save_html_content()" })
//退出键盘
inputMethod.getInputMethodController().stopInput();
// 清除定时器
if (timeId != undefined) {
LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId)
clearInterval(timeId)
}
} else {
this.sectionStatus = 3
}
}
this.editModel = !this.editModel
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "ToolBarComp, set continue section success")
})
.visibility(!this.selectedNoteData ? Visibility.None : this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
if (this.selectedNoteData) {
if (this.selectedNoteData.is_deleted == Delete.Yes) {
Row({ space: StyleConstants.SPACE_24 }) {
Image($r('app.media.delete'))
.height(24)
.width(24)
.onClick(() => {
this.noteDataDeleteDialogCtl.open()
})
Image($r('app.media.recover'))
.height(24)
.width(24)
.onClick(() => {
this.selectedNoteData.is_deleted = Delete.No
this.selectedNoteData.deleted_time = 0
prompt.showToast({ message: "已恢复", duration: 2000 })
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
this.chooseNote = false
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "recover, set continue note success")
})
}.width(72)
} else if (this.editModel == true) {
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()" })
// 退出键盘
inputMethod.getInputMethodController().stopInput();
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.styles'))
.height(24)
.width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
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)
.onClick(async () => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
LogUtil.info(TAG, 'startAbility start')
await globalThis.noteContext.startAbilityForResult({
parameters: { uri: "singleselect" },
bundleName: "com.ohos.photos",
abilityName: "com.ohos.photos.MainAbility",
})
.then(v => {
let want = v['want'];
if (want != null && want != undefined) {
let param = want['parameters'];
let imageUri = ""
if (param != null && param != undefined) {
let uri = param['select-item-list'];
imageUri = uri;
}
// 拷贝
if(imageUri != null && imageUri != "") {
OperationUtils.copy(imageUri).then((uriPath) => {
var path = "file://" + uriPath
LogUtil.info(TAG, 'image uri is:' + path)
this.controllerShow.runJavaScript({script:"javascript:RICH_EDITOR.insertImage('" + path + "')"})
})
}
}
});
})
}.width(42)
.height(42)
.borderRadius(8)
.backgroundColor($r('app.color.color_ffffff'))
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.undo'))
.height(24)
.width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
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(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
this.controllerShow.runJavaScript({ script: "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_thick'))
.height(24)
.width(24)
.fillColor(this.issave == 0 ? Color.Black : Color.Grey)
.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.issave = 1
})
}.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'))
.height(24)
.width(24)
.onClick(() => {
this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes)
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) {
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)
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)
LogUtil.info(TAG, "ToolBarComp, set continue note success")
}
})
Image($r('app.media.delete'))
.height(24)
.width(24)
.onClick(() => {
this.noteDataDeleteDialogCtl.open()
})
}.width(72)
}
}
}
.width(StyleConstants.PERCENTAGE_100)
.height(80)
}
}
@Component
struct NoteDataMoveItemComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
private folderItem: FolderData
build() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.flexShrink(0)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
}
.width(24)
Column() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text(FolderUtil.getFolderText(this.folderItem))
.fontSize(16)
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
.textAlign(TextAlign.Center)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.flexShrink(1)
}
.width('100%')
.height(55)
Divider()
.color($r("app.color.divider_color_e4e4e4"))
.strokeWidth(1)
}
.padding({ left: 16 })
}
.width('100%')
.height(56)
.visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None)
}
}
@@ -13,45 +13,43 @@
* limitations under the License.
*/
import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/DateUtil.ets'
import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets'
import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets'
import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets'
import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets'
import {EditContentDialogPortrait, DeleteDialog, EditTitleDialog} from './CusDialogComp.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import DateUtil from '@ohos/utils/src/main/ets/default/baseUtil/DateUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import { TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete
} from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import { EditContentDialogPortrait, DeleteDialog, EditTitleDialog } from './CusDialogComp'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import prompt from '@system.prompt'
import featureAbility from '@ohos.ability.featureAbility';
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import OperationUtils from '../../../../../../common/utils/src/main/ets/default/baseUtil/OperationUtils.ets'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import OperationUtils from '@ohos/utils/src/main/ets/default/baseUtil/OperationUtils'
import router from '@system.router'
import inputMethod from '@ohos.inputmethod';
var timeId : number
var time_id: number
const TAG = "NoteContentCompPortrait"
// Note content component
@Component
export struct NoteContentCompPortrait {
@Consume('SelectedNoteData') selectedNoteData: NoteData;
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote')
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder")
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SectionStatus') sectionStatus: number
@Consume('ChooseNote') chooseNote: boolean
@Consume('EditModel') editModel: boolean
private controllerShow: WebController = new WebController()
@Provide('EditModel') editModel: boolean = false
controllerShow: WebController
private editContentFlag = false
@State uri1: string = "";
private context = getContext(this)
noteContent = {
callbackhtml: (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)
this.selectedNoteData.content_img = RdbStoreUtil.updataNoteImage(this.selectedNoteData)
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
@@ -60,7 +58,6 @@ export struct NoteContentCompPortrait {
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "callbackhtml, set continue note success")
return "AceString"
},
callbackScheduledSave: (html) => {
@@ -68,7 +65,7 @@ export struct NoteContentCompPortrait {
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)
this.selectedNoteData.content_img = RdbStoreUtil.updataNoteImage(this.selectedNoteData)
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
@@ -82,18 +79,15 @@ export struct NoteContentCompPortrait {
}
build() {
Stack({ alignContent: Alignment.Bottom }) {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap,
Column() {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
Column() {
ToolBarComp({ controllerShow: this.controllerShow })
NoteContentOverViewComp()
}
Column() {
NoteContentOverViewComp()
Text(this.refreshFlag.toString()).visibility(Visibility.None)
Text(this.AllNoteArray.length.toString()).visibility(Visibility.None) // 用于强制刷新使用
Web({ src: $rawfile('editor.html'), controller: this.controllerShow })
.javaScriptAccess(true)
.onPageEnd((e) => {
@@ -101,29 +95,28 @@ export struct NoteContentCompPortrait {
this.controllerShow.registerJavaScriptProxy({
object: this.noteContent,
name: "callBackToApp", // html--> name.method
methodList: ["callbackhtml","callbackScheduledSave"],
});
methodList: ["callbackhtml", "callbackScheduledSave"],
})
LogUtil.info(TAG, "finish register")
this.controllerShow.refresh()
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
// 初次进入预览模式
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
})
})
.zoomAccess(false)
.height(450)
.height('70%')
.width('100%')
}
.margin({ top: 16 })
.width(StyleConstants.PERCENTAGE_100)
.opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1)
.enabled(this.selectedNoteData.is_deleted == Delete.Yes ? false : true)
.flexShrink(1)
.onClick(() => {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
// 添加定时器:3s自动保存
time_id = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduled_save_content()" })
}, 3000)
LogUtil.info(TAG, "setInterval time_id : " + time_id)
this.editModel = true
// 添加定时器:3s自动保存
timeId = setInterval(() => {
@@ -131,10 +124,11 @@ export struct NoteContentCompPortrait {
}, 3000)
LogUtil.info(TAG, "NoteContentCompPortrait, setInterval timeId : " + timeId)
})
.margin({ top: 16 })
.width(StyleConstants.PERCENTAGE_100)
}
.height(StyleConstants.PERCENTAGE_100)
.flexShrink(1)
.margin({ left: 24, right: 24 })
.visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible)
EditNoteCompForPortrait({ controllerShow: this.controllerShow })
DeleteNoteComp()
@@ -142,64 +136,99 @@ export struct NoteContentCompPortrait {
.height(StyleConstants.PERCENTAGE_100)
.width(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void{
LogUtil.info(TAG, "aboutToAppear")
}
aboutToDisappear(): void{
LogUtil.info(TAG, "aboutToDisappear")
}
}
@Component
export struct NoteContentOverViewComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData;
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@Consume('SectionStatus') sectionStatus: number
NoteDataMoveArray: FolderData[]
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }),
builder: EditTitleDialog({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
aboutToAppear() {
this.NoteDataMoveArray = this.AllFolderArray.slice(2, this.AllFolderArray.length);
this.NoteDataMoveArray.push(this.AllFolderArray[1]);
}
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, 'NoteContentOverViewComp, MenuBuilder, set continue note success')
}
@Builder MenuBuilder() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
List() {
ForEach(this.AllFolderArray, (item) => {
ListItem() {
NoteDataMoveItemComp({ folderItem: item })
}
.onClick(() => {
this.selectedNoteData.folder_uuid = item.uuid
})
}, noteItem => noteItem.uuid)
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
Column() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
List() {
ForEach(this.NoteDataMoveArray, (item) => {
ListItem() {
NoteDataMoveItemCompMenu({ folderItem: item, uuid: this.selectedNoteData.folder_uuid })
}
.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)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, 'MenuBuilder, set continue note success')
})
}, noteItem => noteItem.uuid)
}
.margin({ top: 4, bottom: 4 })
.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
}
.margin({ top: 24, bottom: 24, left: 24, right: 24 })
.borderRadius(16)
.backgroundColor($r('app.color.folder_color_ffffff'))
.shadow({ color: "#0a000000", offsetX: 0, offsetY: 2, radius: 30 })
.width(148)
.padding({ left: 24, right: 24 })
}
.width(148)
.backgroundColor($r("app.color.color_fffffB"))
.padding({ left: 24, right: 24 })
}
build() {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Text(this.selectedNoteData.title).fontSize(30)
Text(this.selectedNoteData.title).fontSize(30).fontWeight(FontWeight.Medium)
.onClick(() => {
this.editTitleDialogCtl.open()
})
}.height(40).width(StyleConstants.PERCENTAGE_100)
}.height(40)
.width(StyleConstants.PERCENTAGE_100)
Row() {
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))).fontSize(12)
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
.fontSize(12)
.padding({ top: 4, bottom: 4 })
.fontColor($r("app.color.modified_time_font_color"))
Row() {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
.fontColor($r('app.color.folder_color_99182431'))
.fontSize(12)
Image($r('app.media.triangle'))
.width(6)
@@ -213,43 +242,36 @@ export struct NoteContentOverViewComp {
.bindMenu(this.MenuBuilder)
}.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100)
}
.opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1)
.width(StyleConstants.PERCENTAGE_100)
.height(80)
.height(82)
}
}
@Component
export struct ToolBarComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData;
@Consume('RefreshFlag') refreshFlag: number
@Consume('SectionStatus') sectionStatus: number
@Consume('SelectedNoteData') selectedNoteData: NoteData
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('ChooseNote') chooseNote: boolean
@Consume('PortraitModel') portraitModel: boolean
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('EditModel') editModel: boolean
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
controllerShow: WebController
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image($r('app.media.back')).height(24).width(24)
Image($r('app.media.back'))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
// 退出全屏时存库
this.controllerShow.runJavaScript({ script: "get_html_content()" })
// 删除空白笔记
NoteUtil.deleteEmptyNote(this.selectedNoteData, this.AllNoteArray, this.controllerShow)
this.chooseNote = false
// 进入预览模式
this.controllerShow.runJavaScript({ script: "RE.setInputEnabled(false)" })
this.editModel = false
AppStorage.SetOrCreate('ContinueChoose', this.chooseNote)
// 清除定时器
if (timeId != undefined) {
LogUtil.info(TAG, "back, clearInterval timeId : " + timeId)
clearInterval(timeId)
if (time_id != undefined) {
LogUtil.info(TAG, "back, clearInterval time_id : " + time_id)
clearInterval(time_id)
}
router.back()
})
if (this.editModel == false) {
@@ -258,19 +280,17 @@ export struct ToolBarComp {
.height(24).width(24)
.onClick(() => {
this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes)
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) {
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)
// 迁移
LogUtil.info(TAG, "ToolBarComp, set continue note")
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "ToolBarComp, set continue note success")
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, 'ToolBarComp, set continue note success')
})
}.width(36)
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
@@ -279,6 +299,8 @@ export struct ToolBarComp {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.undo')).height(24).width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.undo()" })
})
}.width(42)
@@ -289,6 +311,8 @@ export struct ToolBarComp {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.todo')).height(24).width(24)
.onClick(() => {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" })
})
}.width(42)
@@ -301,17 +325,7 @@ export struct ToolBarComp {
.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
// 清除定时器
if (timeId != undefined) {
LogUtil.info(TAG, "tick_thin, clearInterval timeId : " + timeId)
clearInterval(timeId)
}
})
}.width(42)
.height(42)
@@ -323,7 +337,7 @@ export struct ToolBarComp {
}
}
.width(StyleConstants.PERCENTAGE_100)
.height(80)
.height(40)
}
}
@@ -334,8 +348,6 @@ export struct DeleteNoteComp {
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SelectedNoteData') selectedNoteData: NoteData;
@Consume('PortraitModel') portraitModel: boolean
@Consume('ChooseNote') chooseNote: boolean
noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }),
alignment: DialogAlignment.Bottom,
@@ -358,10 +370,6 @@ export struct DeleteNoteComp {
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
RdbStoreUtil.delete(predicates_note, null)
}
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
this.chooseNote = false
AppStorage.SetOrCreate('ContinueChoose', this.chooseNote)
}
build() {
@@ -370,6 +378,7 @@ export struct DeleteNoteComp {
Image($r('app.media.delete'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.noteDataDeleteDialogCtlBottom.open()
})
@@ -378,19 +387,21 @@ export struct DeleteNoteComp {
.fontColor($r('app.color.delete_font_color'))
.padding({ top: 5 })
}
.height("100%")
.width(180)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
Column() {
Image($r('app.media.recover'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.selectedNoteData.is_deleted = Delete.No
this.selectedNoteData.deleted_time = 0
prompt.showToast({ message: $r('app.string.restore'), duration: 2000 })
prompt.showToast({ message: $r('app.string.restore').toString(), duration: 2000 })
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
this.chooseNote = false
AppStorage.SetOrCreate('ContinueChoose', this.chooseNote)
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
@@ -401,11 +412,14 @@ export struct DeleteNoteComp {
.fontColor($r('app.color.recover_font_color'))
.padding({ top: 5 })
}
.height("100%")
.width(180)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
.width(360)
.height(56)
.visibility(this.selectedNoteData.is_deleted == Delete.Yes && this.portraitModel == true ?
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ?
Visibility.Visible : Visibility.None)
}
}
@@ -415,14 +429,11 @@ export struct EditNoteCompForPortrait {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SelectedNoteData') selectedNoteData: NoteData;
@Consume('PortraitModel') portraitModel: boolean
@Consume('ChooseNote') chooseNote: boolean
@Consume('EditModel') editModel: boolean
controllerShow: WebController
editContentDialogCtl: CustomDialogController = new CustomDialogController({
builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this), dialogType: 0 }),
builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }),
alignment: DialogAlignment.Bottom,
autoCancel: true,
customStyle: true,
@@ -433,11 +444,12 @@ export struct EditNoteCompForPortrait {
}
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) {
Row() {
Column() {
Image($r('app.media.circle_tick'))
Image($r('app.media.circle_tick1'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
// 清单
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
@@ -447,12 +459,16 @@ export struct EditNoteCompForPortrait {
.fontColor($r('app.color.list_font_color'))
.padding({ top: 5 })
}
.height("100%")
.width(120)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
Column() {
Image($r('app.media.font_style'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.editContentDialogCtl.open()
})
@@ -461,18 +477,52 @@ export struct EditNoteCompForPortrait {
.fontColor($r('app.color.style_font_color'))
.padding({ top: 5 })
}
.height("100%")
.width(120)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
Column() {
Image($r('app.media.picture_white'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(async () => {
LogUtil.info(TAG, 'startAbility start')
await globalThis.noteContext.startAbilityForResult({
parameters: { uri: "singleselect" },
bundleName: "com.ohos.photos",
abilityName: "com.ohos.photos.MainAbility",
}).then(v => {
let want = v['want'];
if (want != null && want != undefined) {
let param = want['parameters'];
let imageUri = ""
if (param != null && param != undefined) {
let uri = param['select-item-list'];
imageUri = uri;
}
LogUtil.info(TAG, "image url" + imageUri)
// 拷贝
if (imageUri != null && imageUri != "") {
OperationUtils.copy(imageUri).then((uriPath) => {
var path = "file://" + uriPath
LogUtil.info(TAG, 'image uri is:' + path)
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.insertImage('" + path + "')" })
})
}
}
});
})
Text($r("app.string.photo"))
.fontSize(10)
.fontColor($r('app.color.photo_font_color'))
.padding({ top: 5 })
}
.height("100%")
.width(120)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
.width(360)
@@ -483,19 +533,21 @@ export struct EditNoteCompForPortrait {
}
@Component
struct NoteDataMoveItemComp {
struct NoteDataMoveItemCompMenu {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
private folderItem: FolderData
folderItem: FolderData
uuid: String
build() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
.objectFit(ImageFit.ScaleDown)
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
.flexShrink(0)
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.folderItem.uuid == this.uuid))
}
.width(24)
@@ -503,7 +555,7 @@ struct NoteDataMoveItemComp {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
Text(FolderUtil.getFolderText(this.folderItem))
.fontSize(16)
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false))
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid == this.uuid ? this.folderItem.uuid : '', this.folderItem.uuid == this.uuid))
.textAlign(TextAlign.Center)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -512,7 +564,12 @@ struct NoteDataMoveItemComp {
.width('100%')
.height(55)
Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1)
if (this.folderItem.uuid != SysDefFolderUuid.UnClassified) {
Divider()
.color($r("app.color.divider_color_e4e4e4"))
.strokeWidth(1)
}
}
.padding({ left: 16 })
}
@@ -520,4 +577,4 @@ struct NoteDataMoveItemComp {
.height(56)
.visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None)
}
}
}
@@ -13,21 +13,34 @@
* limitations under the License.
*/
import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/DateUtil.ets'
import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets'
import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets'
import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete, Top, NoteType} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets'
import {NoteDataMoveDialog, DeleteDialog} from './CusDialogComp.ets'
import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets'
import DateUtil from '@ohos/utils/src/main/ets/default/baseUtil/DateUtil'
import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import { TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete, Top, NoteType
} from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import { NoteDataMoveDialog, DeleteDialog } from './CusDialogComp'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import prompt from '@system.prompt'
import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets'
import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets'
import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets'
import SearchModel from '../../../../../../common/utils/src/main/ets/default/model/searchModel/SearchModel.ets'
import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import SearchModel from '@ohos/utils/src/main/ets/default/model/searchModel/SearchModel'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import router from '@system.router';
const TAG = "NoteListComp"
async function routePage() {
let options = {
uri: 'pages/NoteContentHome'
}
try {
await router.push(options)
} catch (err) {
LogUtil.info(TAG, "fail callback")
}
}
// Note list component
@Component
export struct NoteListComp {
@@ -37,18 +50,28 @@ export struct NoteListComp {
controllerShow: WebController
build() {
Stack({ alignContent: Alignment.Bottom }) {
Flex({ direction: FlexDirection.Column }) {
Flex({ direction: FlexDirection.Column }) {
NoteOverViewComp({ controllerShow: this.controllerShow })
Column() {
}
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.height(this.search ? 15 : 0)
NoteItemListComp({ controllerShow: this.controllerShow })
}
.padding({ top: this.search ? 15 : 0 })
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width('100%')
.height('100%')
.flexShrink(1)
OperateNoteCompForPortrait()
Column() {
OperateNoteCompForPortrait()
}
.flexShrink(0)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
}
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.height('100%')
.width('100%')
}
@@ -60,7 +83,6 @@ export struct NoteListComp {
aboutToDisappear(): void{
LogUtil.info(TAG, "aboutToDisappear")
}
}
@Component
@@ -82,21 +104,21 @@ struct NoteOverViewComp {
Image($r("app.media.suojin_back"))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.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
AppStorage.SetOrCreate('ContinueExpand', this.expandStatus)
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
// 迁移
LogUtil.info(TAG, "NoteOverViewComp, set continue section")
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "NoteOverViewComp, set continue section success")
}
})
}.alignItems(HorizontalAlign.Center)
Flex({
direction: FlexDirection.Column,
wrap: FlexWrap.Wrap,
@@ -124,6 +146,7 @@ struct NoteOverViewComp {
Image($r("app.media.cross"))
.height(24)
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.longpress = false
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
@@ -134,6 +157,7 @@ struct NoteOverViewComp {
.fontColor($r("app.color.note_selected_font_color"))
.margin({ left: 16 })
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontWeight(FontWeight.Medium)
}.alignItems(VerticalAlign.Center)
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
}.padding({ top: 8, bottom: 8 })
@@ -143,7 +167,9 @@ struct NoteOverViewComp {
OperateNoteComp({ controllerShow: this.controllerShow })
Text(this.refreshFlag.toString()).visibility(Visibility.None)
}
.width('100%').height(82)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width('100%')
.height(82)
.padding({ left: this.sectionStatus == 2 ? 24 : 36, right: 24 }) // 两分栏时缩进图标与左侧不需要间距
.visibility(this.search ? Visibility.None : Visibility.Visible)
}
@@ -163,7 +189,7 @@ export struct NoteItemComp {
@Consume('RefreshFlag') refreshFlag: number
@Consume('Search') search: boolean
@Consume('selectedAll') selectedAll: boolean
@Consume('PortraitModel') portraitModel:boolean
@Consume('PortraitModel') portraitModel: boolean
build() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
@@ -181,9 +207,15 @@ export struct NoteItemComp {
}), item => {
if (item.data.type == 0) {
Span(item.data.text).fontColor($r("app.color.note_title_font_color")).fontSize(16).fontWeight(FontWeight.Medium)
Span(item.data.text)
.fontColor($r("app.color.note_title_font_color"))
.fontSize(16)
.fontWeight(FontWeight.Medium)
} else if (item.data.type == 1) {
Span(item.data.text).fontColor($r("app.color.note_title_font_color_blue")).fontSize(16).fontWeight(FontWeight.Medium)
Span(item.data.text)
.fontColor($r("app.color.note_title_font_color_blue"))
.fontSize(16)
.fontWeight(FontWeight.Medium)
}
},
item => item.index)
@@ -207,17 +239,18 @@ export struct NoteItemComp {
}
.padding({ left: 12 })
}.alignItems(HorizontalAlign.Start)
}.width(240)
}.flexShrink(1)
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Stack({ alignContent: Alignment.Center }) {
Image(this.noteItem.content_img)
.height(48)
.width(48)
.height(47)
.width(47)
.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)
@@ -229,7 +262,9 @@ export struct NoteItemComp {
}.width(24)
.height(24)
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
}.height(48)
}
.flexShrink(0)
.height(48)
.width(this.longpress ? 80 : 48)
}
.width('100%')
@@ -253,6 +288,7 @@ export struct NoteItemComp {
NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem)
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
}
return;
} else {
this.selectedNoteData = this.noteItem
this.chooseNote = true
@@ -262,8 +298,15 @@ export struct NoteItemComp {
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "NoteItemComp, set continue note success")
}
if(this.portraitModel == false) {
this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
if (this.portraitModel == false) {
this.controllerShow.runJavaScript({
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
})
}
if (this.portraitModel == true) {
AppStorage.SetOrCreate<NoteData>('NewNote', this.selectedNoteData)
AppStorage.SetOrCreate<FolderData>('NewFolder', this.selectedFolderData)
routePage()
}
this.selectedAll = this.CheckedNoteArray.length ==
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length
@@ -295,6 +338,7 @@ export struct NoteItemListComp {
@Consume @Watch('doSearch') inputKeyword: string
@Consume('SearchResultList') searchResultList: NoteData[]
@Consume('SelectedNoteData') selectedNoteData: NoteData
@Consume('PortraitModel') portraitModel: boolean
controllerShow: WebController
doSearch() {
@@ -307,7 +351,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 + "')" })
if (this.portraitModel == false) {
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)
@@ -317,57 +365,88 @@ export struct NoteItemListComp {
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
Text(this.refreshFlag.toString()).visibility(Visibility.None)
Flex() {
SearchComp()
}.margin({ left: 24, right: 24, bottom: 12 })
}
.width("100%")
.padding({ left: 24, right: 24, bottom: 12 })
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible)
Flex({ justifyContent: FlexAlign.Center }) {
Text($r("app.string.permanently_delete_tips"))
.fontSize(12)
.fontColor($r("app.color.Recently_delete_prompt_font_color"))
}
.margin({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 })
.width('100%')
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None)
Column() {
List({ initialIndex: 0 }) {
ListItem() {
Column({ space: 8 }) {
Image($r('app.media.emptyPage'))
.width(120)
.height(120)
Text($r("app.string.Empty_page"))
.fontSize(12)
.fontColor($r("app.color.Empty_page_font_color"))
}
Stack() {
Flex({direction: FlexDirection.Column}) {
Flex({ justifyContent: FlexAlign.Center }) {
Text($r("app.string.permanently_delete_tips"))
.fontSize(12)
.fontColor($r("app.color.Recently_delete_prompt_font_color"))
}
.padding({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 })
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.width('100%')
.height('100%')
.padding({ bottom: 120 })
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.Visible : Visibility.None)
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None)
ForEach(this.inputKeyword.length == 0 ?
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) : this.searchResultList, (noteItem) => {
ListItem() {
NoteItemComp({
noteItem: noteItem,
spans: SearchModel.splitToHighlightText(noteItem.title, this.inputKeyword),
controllerShow: this.controllerShow
})
}.margin({ left: 24, right: 24, bottom: 12 })
}, noteItem => noteItem.uuid.toString())
}.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
Column() {
List({ initialIndex: 0 }) {
ListItem() {
Column({ space: 8 }) {
Image($r('app.media.emptyPage'))
.width(120)
.height(120)
Text($r("app.string.Empty_page"))
.fontSize(12)
.fontColor($r("app.color.Empty_page_font_color"))
}
}
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.width('100%')
.height('100%')
.padding({ bottom: 120 })
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.Visible : Visibility.None)
ForEach(this.inputKeyword.length == 0 ?
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) : this.searchResultList, (noteItem) => {
ListItem() {
Column() {
NoteItemComp({
noteItem: noteItem,
spans: SearchModel.splitToHighlightText(noteItem.title, this.inputKeyword),
controllerShow: this.controllerShow
})
}
.padding({ left: 24, right: 24, bottom: 12 })
}
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
}, noteItem => noteItem.uuid.toString())
}
.layoutWeight(1)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
}
.layoutWeight(1)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.height("100%")
.margin({ top: this.search ? 8 : 0 })
}
.height("100%")
.width("100%")
// search input mask
Column() {
}
.height("100%")
.width("100%")
.backgroundColor("#18181A")
.opacity(0.1)
.visibility(this.search ? Visibility.Visible : Visibility.Hidden)
}
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.height('100%')
.flexShrink(1)
}
.height('80%')
.padding({ bottom: 1 })
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.flexShrink(1)
.onClick(() => {
this.search = false
})
@@ -401,6 +480,13 @@ export struct OperateNoteComp {
RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null)
})
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "onMoveConfirm, set continue note success")
if (this.portraitModel == false) {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
}
this.longpress = false
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
@@ -436,8 +522,8 @@ export struct OperateNoteComp {
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
this.longpress = false
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
if(this.portraitModel == false) {
this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
if (this.portraitModel == false) {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
@@ -542,6 +628,7 @@ export struct AddNoteComp {
.width(24)
.height(24)
.margin({ right: 12 })
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
let noteData
if (this.selectedFolderData.uuid == SysDefFolderUuid.AllNotes) {
@@ -555,24 +642,22 @@ export struct AddNoteComp {
LogUtil.info(TAG, 'insert new note is:' + noteData.uuid)
this.selectedNoteData = noteData
if (this.sectionStatus != 1) {
this.lastSectionStatus = this.sectionStatus
this.sectionStatus = 1
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
} else {
this.sectionStatus = this.lastSectionStatus
AppStorage.SetOrCreate<NoteData>('NewNote', noteData)
if (this.portraitModel == false) {
this.controllerShow.runJavaScript({
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
})
}
if(this.portraitModel == false) {
this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
if (this.portraitModel == true) {
this.editModel = true
}
this.editModel = true
this.chooseNote = true
AppStorage.SetOrCreate('ContinueChoose', this.chooseNote)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(TAG, "addNote, set continue note and section success")
LogUtil.info(TAG, "addNote, set continue note success")
routePage()
})
.visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible)
}
@@ -582,12 +667,14 @@ export struct AddNoteComp {
export struct SearchComp {
@Consume('Search') search: boolean
@Consume('InputKeyword') inputKeyword: string
@Consume('Longpress') longpress: boolean
build() {
Row() {
Image($r('app.media.back'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.margin({ right: this.search ? 16 : 0 })
.visibility(this.search ? Visibility.Visible : Visibility.None)
.onClick(() => {
@@ -597,23 +684,36 @@ export struct SearchComp {
Flex({ justifyContent: FlexAlign.Start }) {
Image($r('app.media.search')).width(18).height(18)
TextInput({ placeholder: $r('app.string.searchNote') })
.backgroundColor($r("app.color.color_ffffff"))
.backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") : $r("app.color.color_ffffff"))
.caretColor($r("app.color.search_note_caret_color"))
.enabled(this.longpress ? false : true)
.padding({left:6})
.onEditChange((isEditing: boolean) => {
this.search = isEditing
})
.onChange((value: string) => {
LogUtil.info(TAG, "Search value: " + value)
this.inputKeyword = value
if (!this.longpress) {
LogUtil.info(TAG, "Search value: " + value)
this.inputKeyword = value
}
})
.onClick(() => {
this.search = true
if (this.longpress) {
this.search = false
} else {
this.search = true
}
})
}
.backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") : $r("app.color.color_ffffff"))
.height(40)
.opacity(this.longpress ? 0.4 : 1)
.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 })
}
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
}
}
@@ -623,9 +723,10 @@ export struct OperateNoteCompForPortrait {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('RefreshFlag') @Watch('opacityChange') refreshFlag: number
@Consume('SelectedNoteData') selectedNoteData: NoteData
@Consume('PortraitModel') portraitModel: boolean
@State greyOpacity: boolean = false
noteDataMoveDialogCtlBottom: CustomDialogController = new CustomDialogController({
builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }),
alignment: DialogAlignment.Bottom,
@@ -633,6 +734,16 @@ export struct OperateNoteCompForPortrait {
customStyle: true,
})
opacityChange() {
if (this.CheckedNoteArray.length == 0) {
this.greyOpacity = true
LogUtil.info(TAG, "none checked array")
} else {
this.greyOpacity = false
LogUtil.info(TAG, this.CheckedNoteArray.length.toString())
}
}
onMoveConfirm(folderUuid: string) {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.folder_uuid = folderUuid
@@ -642,6 +753,10 @@ export struct OperateNoteCompForPortrait {
RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null)
})
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, "onMoveConfirm, set continue note success")
this.longpress = false
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
@@ -684,12 +799,14 @@ export struct OperateNoteCompForPortrait {
}
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) {
Row() {
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
Column() {
Image($r("app.media.set_top"))
.opacity(this.greyOpacity ? 0.4 : 1)
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.is_top = (noteItem.is_top == Top.Yes) ? Top.No : Top.Yes
@@ -702,47 +819,66 @@ export struct OperateNoteCompForPortrait {
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
})
Text($r("app.string.set_top"))
.opacity(this.greyOpacity ? 0.4 : 1)
.fontSize(10)
.fontColor($r("app.color.set_top_font_color"))
.padding({ top: 5 })
}
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width("25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
Column() {
Image($r('app.media.delete'))
.opacity(this.greyOpacity ? 0.4 : 1)
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.noteDataDeleteDialogCtlBottom.open()
})
Text($r("app.string.delete"))
.opacity(this.greyOpacity ? 0.4 : 1)
.fontSize(10)
.fontColor($r("app.color.delete_font_color"))
.padding({ top: 5 })
}
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
Column() {
Image($r('app.media.move'))
.opacity(this.greyOpacity ? 0.4 : 1)
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.noteDataMoveDialogCtlBottom.open()
})
Text($r("app.string.move"))
.opacity(this.greyOpacity ? 0.4 : 1)
.fontSize(10)
.fontColor($r("app.color.move_font_color"))
.padding({ top: 5 })
}
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width("25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
@@ -751,11 +887,12 @@ export struct OperateNoteCompForPortrait {
Image($r('app.media.recover'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.is_deleted = Delete.No
noteItem.deleted_time = 0
prompt.showToast({ message: $r('app.string.restore'), duration: 2000 })
prompt.showToast({ message: $r('app.string.restore').toString(), duration: 2000 })
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, noteItem.uuid)
@@ -770,15 +907,20 @@ export struct OperateNoteCompForPortrait {
.fontColor($r("app.color.recover_font_color"))
.padding({ top: 5 })
}
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
Column() {
Image($r('app.media.check_all'))
.width(24)
.height(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
if (this.CheckedNoteArray.length <
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
@@ -794,9 +936,13 @@ export struct OperateNoteCompForPortrait {
.fontColor($r("app.color.check_all_font_color"))
.padding({ top: 5 })
}
.backgroundColor($r('app.color.notelist_bgcolor_f1f3f5'))
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.height("100%")
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
.width(360)
.width("100%")
.height(56)
.visibility(this.longpress && this.portraitModel == true ? Visibility.Visible : Visibility.None)
}
+26
View File
@@ -0,0 +1,26 @@
/*
* 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.
*/
{
"module": {
"name": "component",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}
+3
View File
@@ -0,0 +1,3 @@
/node_modules
/.preview
/build
+20
View File
@@ -0,0 +1,20 @@
/*
* 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.
*/
{
"apiType": "stageMode",
"buildOption": {
}
}
+3
View File
@@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks
+16
View File
@@ -0,0 +1,16 @@
/*
* 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.
*/
export { MainPage } from './src/main/ets/components/MainPage/MainPage'
+5
View File
@@ -0,0 +1,5 @@
{
"name": "@ohos/resources",
"version": "1.0.0",
"lockfileVersion": 1
}
+14
View File
@@ -0,0 +1,14 @@
{
"license":"ISC",
"types":"",
"devDependencies":{},
"name":"@ohos/resources",
"description":"a npm package which contains arkUI2.0 page",
"ohos":{
"org":""
},
"main":"index.ets",
"repository":{},
"version":"1.0.0",
"dependencies":{}
}
@@ -15,11 +15,18 @@
@Entry
@Component
struct Index {
export struct MainPage {
@State message: string = 'Hello World'
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.width('100%')
.height('100%')
}
}
}
+26
View File
@@ -0,0 +1,26 @@
/*
* 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.
*/
{
"module": {
"name": "resources",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}
@@ -0,0 +1,216 @@
{
"color": [
{
"name": "color_ffffff",
"value": "#ffffff"
},
{
"name": "color_fffffB",
"value": "#FFFBFBFB"
},
{
"name": "delete_color_fa2a2d",
"value": "#fa2a2d"
},
{
"name": "cancel_color_4fb4e3",
"value": "#4fb4e3"
},
{
"name": "divider_color_e4e4e4",
"value": "#cce4e4e4"
},
{
"name": "divider_color_182431",
"value": "#182431"
},
{
"name": "button_color_419fff",
"value": "#419fff"
},
{
"name": "button_color_fb4447",
"value": "#fb4447"
},
{
"name": "text_color_3f97e9",
"value": "#3f97e9"
},
{
"name": "text_color_f86d05",
"value": "#f86d05"
},
{
"name": "folder_color_182431",
"value": "#182431"
},
{
"name": "folder_color_99182431",
"value": "#99182431"
},
{
"name": "folder_color_f86d05",
"value": "#f86d05"
},
{
"name": "folder_color_ffffff",
"value": "#ffffff"
},
{
"name": "folder_color_19ffffff",
"value": "#19ffffff"
},
{
"name": "folder_color_d6d6d6",
"value": "#d6d6d6"
},
{
"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": "search_longpress_bgcolor_f7f8f9",
"value": "#f7f8f9"
},
{
"name": "notelist_bgcolor_f1f3f5",
"value": "#f1f3f5"
},
{
"name": "notelist_bgcolor_000000",
"value": "#000000"
},
{
"name": "image_bordercolor_19182431",
"value": "#19182431"
},
{
"name": "button_color_f86d05",
"value": "#f86d05"
},
{
"name": "font_stylecolor_AD182431",
"value": "#AD182431"
},
{
"name": "New_folder_input_box_color",
"value": "#FFFFFF"
},
{
"name": "category_already_exist_font_color",
"value": "#FA2A2D"
},
{
"name": "category_already_exist_divider_color",
"value": "#FA2A2D"
},
{
"name": "create_folder_bg_color",
"value": "#FFFFFF"
},
{
"name": "delete_note_bg_color",
"value": "#FFFFFF"
},
{
"name": "choose_folder_bg_color",
"value": "#FFFFFF"
},
{
"name": "title_input_bg_color",
"value": "#FFFFFF"
},
{
"name": "Edit_title_bg_color",
"value": "#FFFFFF"
},
{
"name": "press_folder_bg_color",
"value": "#FFFFFF"
},
{
"name": "modified_time_font_color",
"value": "#A3A7AD"
},
{
"name": "delete_font_color",
"value": "#182431"
},
{
"name": "recover_font_color",
"value": "#182431"
},
{
"name": "list_font_color",
"value": "#182431"
},
{
"name": "style_font_color",
"value": "#182431"
},
{
"name": "photo_font_color",
"value": "#182431"
},
{
"name": "all_notes_font_color",
"value": "#182431"
},
{
"name": "num_of_notes_font_color",
"value": "#A3A7AD"
},
{
"name": "note_selected_font_color",
"value": "#182431"
},
{
"name": "note_title_font_color",
"value": "#182431"
},
{
"name": "note_title_font_color_blue",
"value": "#0000ff"
},
{
"name": "list_modified_time_font_color",
"value": "#99182431"
},
{
"name": "Recently_delete_prompt_font_color",
"value": "#99182431"
},
{
"name": "Empty_page_font_color",
"value": "#A3A7AD"
},
{
"name": "search_note_caret_color",
"value": "#F86D05"
},
{
"name": "set_top_font_color",
"value": "#182431"
},
{
"name": "move_font_color",
"value": "#182431"
},
{
"name": "check_all_font_color",
"value": "#182431"
}
]
}

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 330 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<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 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#182431;}
</style>
<title>画板</title>
<path class="st0" d="M12,1c6.1,0,11,4.9,11,11s-4.9,11-11,11S1,18.1,1,12S5.9,1,12,1z M12,2.5c-5.2,0-9.5,4.3-9.5,9.5
s4.3,9.5,9.5,9.5s9.5-4.3,9.5-9.5S17.2,2.5,12,2.5z M18.2,8.7c0.3,0.3,0.3,0.7,0,1l0,0l-5.9,5.9c-0.7,0.7-1.7,0.7-2.4,0l0,0
l-3.4-3.4c-0.1-0.1-0.2-0.2-0.2-0.4l0-0.1v-0.1c0-0.2,0.1-0.3,0.2-0.5c0.3-0.3,0.7-0.3,1,0l0,0l3.1,3.1c0.3,0.3,0.7,0.3,1,0l0,0
l5.6-5.6C17.4,8.4,17.9,8.4,18.2,8.7z"/>
</svg>

After

Width:  |  Height:  |  Size: 831 B

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 350 B

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 350 B

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 478 B

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 585 B

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>删除</title>
<defs>
<path d="M5.629,7.5 L6.72612901,18.4738834 C6.83893748,19.6019681 7.77211147,20.4662096 8.89848718,20.4990325 L8.96496269,20.5 L15.0342282,20.5 C16.1681898,20.5 17.1211231,19.6570911 17.2655686,18.5392856 L17.2731282,18.4732196 L18.1924161,9.2527383 L18.369,7.5 L19.877,7.5 L19.6849078,9.40262938 L18.7657282,18.6220326 C18.5772847,20.512127 17.0070268,21.9581787 15.1166184,21.9991088 L15.0342282,22 L8.96496269,22 C7.06591715,22 5.47142703,20.5815579 5.24265599,18.7050136 L5.23357322,18.6231389 L4.121,7.5 L5.629,7.5 Z M10.25,11.75 C10.6642136,11.75 11,12.0857864 11,12.5 L11,18.5 C11,18.9142136 10.6642136,19.25 10.25,19.25 C9.83578644,19.25 9.5,18.9142136 9.5,18.5 L9.5,12.5 C9.5,12.0857864 9.83578644,11.75 10.25,11.75 Z M13.75,11.75 C14.1642136,11.75 14.5,12.0857864 14.5,12.5 L14.5,18.5 C14.5,18.9142136 14.1642136,19.25 13.75,19.25 C13.3357864,19.25 13,18.9142136 13,18.5 L13,12.5 C13,12.0857864 13.3357864,11.75 13.75,11.75 Z M12,1.75 C13.7692836,1.75 15.2083571,3.16379796 15.2491124,4.92328595 L15.25,5 L21,5 C21.4142136,5 21.75,5.33578644 21.75,5.75 C21.75,6.14942022 21.43777,6.47591522 21.0440682,6.49872683 L21,6.5 L14.5,6.5 C14.1005798,6.5 13.7740848,6.18777001 13.7512732,5.7940682 L13.75,5.75 L13.75,5 C13.75,4.03350169 12.9664983,3.25 12,3.25 C11.0536371,3.25 10.2827253,4.00119585 10.2510148,4.93983756 L10.25,5 L10.25,5.75 C10.25,6.14942022 9.93777001,6.47591522 9.5440682,6.49872683 L9.5,6.5 L2.75,6.5 C2.33578644,6.5 2,6.16421356 2,5.75 C2,5.35057978 2.31222999,5.02408478 2.7059318,5.00127317 L2.75,5 L8.75,5 C8.75,3.20507456 10.2050746,1.75 12,1.75 Z" id="path-1"></path>
</defs>
<g id="删除" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状结合" fill="#182431" fill-rule="nonzero" xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 590 B

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 904 B

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 813 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.9 KiB

@@ -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 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#007DFF;}
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FF6100;}
.st1{filter:url(#filter-2);}
.st2{fill-rule:evenodd;clip-rule:evenodd;}
.st3{fill:none;stroke:#000000;stroke-opacity:5.000000e-02;}
@@ -18,15 +18,13 @@
<feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="0.5"></feGaussianBlur>
<feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"></feColorMatrix>
</filter>
<title>选中</title>
<g transform="translate(2.000000, 2.000000)">
<circle id="Oval-21" class="st0" cx="10" cy="10" r="10"/>
<g id="Oval-43">
<g class="st1">
<circle id="path-1_1_" class="st2" cx="10" cy="10" r="5"/>
</g>
<circle class="st3" cx="10" cy="10" r="5.5"/>
<title>画板</title>
<circle id="Oval-21" class="st0" cx="12" cy="12" r="10"/>
<g id="Oval-43">
<g class="st1">
<circle id="path-1_1_" class="st2" cx="12" cy="12" r="5"/>
</g>
<circle class="st4" cx="10" cy="10" r="5"/>
<circle class="st3" cx="12" cy="12" r="5.5"/>
</g>
<circle class="st4" cx="12" cy="12" r="5"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 880 B

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 567 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 555 B

After

Width:  |  Height:  |  Size: 555 B

Before

Width:  |  Height:  |  Size: 678 B

After

Width:  |  Height:  |  Size: 678 B

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

Before

Width:  |  Height:  |  Size: 620 B

After

Width:  |  Height:  |  Size: 620 B

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 533 B

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 404 B

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 443 B

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

Before

Width:  |  Height:  |  Size: 879 B

After

Width:  |  Height:  |  Size: 879 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Public/ic_public_reduce</title>
<defs>
<path d="M2.96680416,4.02746433 C2.68362252,3.7442827 2.69149532,3.27728176 2.98438854,2.98438854 C3.27728176,2.69149532 3.7442827,2.68362252 4.02746433,2.96680416 L10.7801475,9.71948734 C11.0633291,10.002669 11.0554564,10.4696699 10.7625631,10.7625631 C10.4696699,11.0554564 10.002669,11.0633291 9.71948734,10.7801475 L2.96680416,4.02746433 Z M19.75,12.5 L19.7940682,12.5012732 C19.9384255,12.5096374 20.0718294,12.5588302 20.1829044,12.6374761 L20.2618461,12.7018051 L20.2946723,12.7344084 C20.4219425,12.8688111 20.5,13.0502899 20.5,13.25 C20.5,13.6296958 20.2178461,13.943491 19.8517706,13.9931534 L19.75,14 L15.0604628,13.9994628 L21.0331756,19.9725154 C21.3163684,20.2557082 21.3085047,20.7227182 21.0156115,21.0156115 C20.7227182,21.3085047 20.2557082,21.3163684 19.9725154,21.0331756 L13.9994628,15.0604628 L13.9987268,19.7940682 C13.9759152,20.18777 13.6494202,20.5 13.25,20.5 C13.090942,20.5 12.9434485,20.4504863 12.8220921,20.3660313 L12.7362032,20.2963663 L12.7036337,20.2637968 L12.6731019,20.2292885 C12.586627,20.1253173 12.5277267,19.9975979 12.5076256,19.857355 L12.5,19.75 L12.5,14.25 L12.5010148,14.1898376 C12.5310564,13.300598 13.2245361,12.5795925 14.1021145,12.5061604 L14.25,12.5 L19.75,12.5 Z M10.75,3.5 C10.909058,3.5 11.0565515,3.54951372 11.1779079,3.63396869 L11.2637968,3.7036337 L11.2963663,3.73620318 L11.3268981,3.77071147 C11.413373,3.87468274 11.4722733,4.0024021 11.4923744,4.14264502 L11.5,4.25 L11.4989852,9.81016244 C11.4689436,10.699402 10.7754639,11.4204075 9.89788549,11.4938396 L9.75,11.5 L4.2059318,11.4987268 C4.06157447,11.4903626 3.92817057,11.4411698 3.81709563,11.3625239 L3.73815385,11.2981949 L3.70532772,11.2655916 C3.5780575,11.1311889 3.5,10.9497101 3.5,10.75 C3.5,10.3703042 3.78215388,10.056509 4.14822944,10.0068466 L4.25,10 L9.2940682,9.99872683 C9.65496152,9.97781619 9.94739589,9.70172714 9.99362875,9.34820224 L10,9.25 L10,4.25 L10.0012732,4.2059318 C10.0240848,3.81222999 10.3505798,3.5 10.75,3.5 Z" id="path-1"></path>
</defs>
<g id="Public/ic_public_reduce" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="形状" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 1017 B

After

Width:  |  Height:  |  Size: 1017 B

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 840 B

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

Before

Width:  |  Height:  |  Size: 921 B

After

Width:  |  Height:  |  Size: 921 B

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 499 B

Before

Width:  |  Height:  |  Size: 879 B

After

Width:  |  Height:  |  Size: 879 B

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 662 B

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 478 B

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 370 B

Before

Width:  |  Height:  |  Size: 438 B

After

Width:  |  Height:  |  Size: 438 B

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 559 B

Some files were not shown because too many files have changed in this diff Show More