!117 一多适配

Merge pull request !117 from wangzhiyusss/master
This commit is contained in:
openharmony_ci 2022-11-11 03:21:25 +00:00 committed by Gitee
commit a091daf69a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
55 changed files with 649 additions and 1563 deletions

View File

@ -12,6 +12,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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": {
@ -25,20 +40,8 @@
},
"modules": [
{
"name": "phone",
"srcPath": "./product/phone",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "tablet",
"srcPath": "./product/tablet",
"name": "default",
"srcPath": "./product/default",
"targets": [
{
"name": "default",
@ -52,13 +55,13 @@
"name": "utils",
"srcPath": "./common/utils"
},
{
"name": "component",
"srcPath": "./common/component"
},
{
"name": "resources",
"srcPath": "./common/resources"
},
{
"name": "component",
"srcPath": "./features",
}
]
}

View File

@ -1,20 +0,0 @@
/*
* 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": {
}
}

View File

@ -1,21 +0,0 @@
/*
* 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';

View File

@ -1,17 +0,0 @@
{
"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"
}
}

View File

@ -1,14 +1,14 @@
{
"license":"ISC",
"types":"",
"devDependencies":{},
"name":"@ohos/resources",
"description":"a npm package which contains arkUI2.0 page",
"ohos":{
"org":""
"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":{}
}
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -18,7 +18,7 @@
"name": "resources",
"type": "har",
"deviceTypes": [
"phone",
"default",
"tablet"
],
"uiSyntax": "ets"

View File

@ -40,13 +40,13 @@ body {
background-size: cover;
color: #182431;
opacity: 0.9;
font-size: 16px;
font-size: 16vp;
height: 100%;
}
#editorjs[placeholder]:empty:not(:focus):before {
content: attr(placeholder);
font-size: 16px;
font-size: 16vp;
color: #9b9b9b;
}

View File

@ -1,16 +1,16 @@
{
"license":"ISC",
"types":"",
"devDependencies":{},
"name":"@ohos/utils",
"description":"a npm package which contains arkUI2.0 page",
"ohos":{
"org":""
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/utils",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main":"index.ets",
"repository":{},
"version":"1.0.0",
"dependencies":{
"@ohos/source":"file:../resources"
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/source": "file:../resources"
}
}
}

View File

@ -18,7 +18,7 @@
"name": "utils",
"type": "har",
"deviceTypes": [
"phone",
"default",
"tablet"
],
"uiSyntax": "ets"

View File

@ -1,3 +1,4 @@
/node_modules
/.preview
/build
/build
/.cxx

View File

@ -13,13 +13,21 @@
* limitations under the License.
*/
{
"apiType": 'stageMode',
"buildOption": {
},
"entryModules": [
"phone",
"tablet"
],
"targets": [
{
"name": "default",
"name": "default"
},
{
"name": "ohosTest",
}
]
}

View File

@ -5,16 +5,16 @@
"requires": true,
"dependencies": {
"@ohos/source": {
"version": "file:../resources"
"version": "file:../common/resources"
},
"@ohos/utils": {
"version": "file:../utils",
"version": "file:../common/utils",
"requires": {
"@ohos/source": "file:../resources"
"@ohos/source": "file:../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../resources"
"version": "file:../common/resources"
}
}
}

17
features/package.json Normal file
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:../common/utils",
"@ohos/source": "file:../common/resources"
}
}

View File

@ -15,7 +15,14 @@
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
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'
@ -27,9 +34,10 @@ import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
// Folder list component
@Component
export struct FolderListComp {
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@Consume('SectionStatus') sectionStatus: number
@Consume('ExpandStatus') expandStatus: boolean // 笔记本折叠展开状态
@StorageLink('breakPoint') breakPoints: string = 'lg'
controllerShow: WebController
TAG = "FolderListComp"
@ -42,7 +50,7 @@ export struct FolderListComp {
.width(24)
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
.onClick(() => {
if (this.sectionStatus == 1) {
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
@ -92,18 +100,18 @@ export struct FolderListComp {
.height("100%")
}
aboutToAppear(): void{
aboutToAppear(): void {
LogUtil.info(this.TAG, "aboutToAppear")
}
aboutToDisappear(): void{
aboutToDisappear(): void {
LogUtil.info(this.TAG, "aboutToDisappear")
}
}
@Component
export struct NoteAndCreateComp {
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@Consume('SelectedColor') selectedColor: string
@Consume('PortraitModel') portraitModel: boolean
folderCreateDialogCtl: CustomDialogController = new CustomDialogController({
@ -157,9 +165,9 @@ export struct NoteAndCreateComp {
@Component
struct FolderItemComp {
@State folderItem: FolderData = undefined
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('SelectedNoteData') selectedNoteData: NoteData
@Consume('RefreshFlag') refreshFlag: number

View File

@ -16,7 +16,14 @@
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
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'
@ -45,7 +52,7 @@ async function routePage() {
// Note list component
@Component
export struct NoteListComp {
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('Search') search: boolean
controllerShow: WebController
@ -73,19 +80,20 @@ export struct NoteListComp {
.width('100%')
}
aboutToAppear(): void{
aboutToAppear(): void {
LogUtil.info(TAG, "aboutToAppear")
}
aboutToDisappear(): void{
aboutToDisappear(): void {
LogUtil.info(TAG, "aboutToDisappear")
}
}
@Component
struct NoteOverViewComp {
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('breakPoint') breakPoints: string = AppStorage.Get('breakPoint')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SectionStatus') sectionStatus: number
@ -100,13 +108,18 @@ struct NoteOverViewComp {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Column() {
Image($r("app.media.suojin_back"))
.height(this.portraitModel ? 24 : '12lpx')
.width(this.portraitModel ? 24 : '12lpx')
.responseRegion({ x: -15.0, y: -15.0, width: this.portraitModel ? 54 : '27lpx', height: this.portraitModel ? 54 : '27lpx'})
.margin({ right: this.sectionStatus != 3 ? this.portraitModel ? 24 : '12lpx' : 0 }) // 两分栏时缩进图片与右边有个24的间距
.visibility(this.sectionStatus != 3 ? Visibility.Visible : Visibility.None)
.height(24)
.width(24)
.responseRegion({
x: -15.0,
y: -15.0,
width: 54,
height: 54
})
.margin({ right: 24 }) // 两分栏时缩进图片与右边有个24的间距
.visibility(this.breakPoints == 'lg' && this.sectionStatus == 3 ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.sectionStatus == 1) {
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
this.expandStatus = !this.expandStatus
} else {
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
@ -124,42 +137,49 @@ struct NoteOverViewComp {
alignItems: ItemAlign.Start
}) {
Text(FolderUtil.getFolderText(this.selectedFolderData))
.fontSize(this.portraitModel ? 30 : '15lpx')
.maxLines(1)
.fontSize(30)
.fontColor($r("app.color.all_notes_font_color"))
.fontWeight(FontWeight.Medium)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString())
.fontSize(this.portraitModel ? 14 : '7lpx')
.maxLines(1)
.fontSize(14)
.fontColor($r("app.color.num_of_notes_font_color"))
Text($r("app.string.noteslist"))
.fontSize(this.portraitModel ? 14 : '7lpx')
.fontSize(14)
.fontColor($r("app.color.num_of_notes_font_color"))
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.margin({ top: this.portraitModel ? 5 : '2.5lpx' })
.margin({ top: 5 })
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible)
}.visibility(this.longpress ? Visibility.None : Visibility.Visible)
Row() {
Image($r("app.media.cross"))
.height(this.portraitModel ? 24 : '12lpx')
.width(this.portraitModel ? 24 : '12lpx')
.responseRegion({ x: -15.0, y: -15.0, width: this.portraitModel ? 54 : '27lpx', height: this.portraitModel ? 54 : '27lpx' })
.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)
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
})
Text(this.CheckedNoteArray.length == 0 ? $r("app.string.none_selected") : $r("app.string.selected", this.CheckedNoteArray.length))
.fontSize(this.portraitModel ? 20 : '10lpx')
.fontSize(20)
.fontColor($r("app.color.note_selected_font_color"))
.margin({ left: this.portraitModel ? 16 : '8lpx' })
.margin({ left: 16 })
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontWeight(FontWeight.Medium)
}.alignItems(VerticalAlign.Center)
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
}.padding({ top: this.portraitModel ? 8 : '4lpx', bottom: this.portraitModel ? 8 : '4lpx' })
}.padding({ top: 8, bottom: 8 })
.height('100%')
AddNoteComp({ controllerShow: this.controllerShow })
@ -167,8 +187,11 @@ struct NoteOverViewComp {
Text(this.refreshFlag.toString()).visibility(Visibility.None)
}
.width('100%')
.height(this.portraitModel ? 82 : '41lpx')
.padding({ left: this.sectionStatus == 2 ? this.portraitModel ? 24 : '12lpx' : this.portraitModel ? 36 : '18lpx', right: this.portraitModel ? 24 : '12lpx' }) // 两分栏时缩进图标与左侧不需要间距
.height(82)
.padding({
left: this.sectionStatus == 2 ? 24 : 36,
right: 24
}) // 两分栏时缩进图标与左侧不需要间距
.visibility(this.search ? Visibility.None : Visibility.Visible)
}
}
@ -180,8 +203,8 @@ export struct NoteItemComp {
controllerShow: WebController
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('SelectedNoteData') selectedNoteData: NoteData
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@Consume('Longpress') longpress: boolean
@Consume('ChooseNote') chooseNote: boolean
@Consume('RefreshFlag') refreshFlag: number
@ -196,8 +219,8 @@ export struct NoteItemComp {
Column({ space: 2 }) {
Row({ space: 8 }) {
Image($r("app.media.verticalBar"))
.height(this.portraitModel ? 16 : '8lpx')
.width(this.portraitModel ? 4 : '2lpx')
.height(16)
.width(4)
.fillColor(NoteUtil.getVerticalBarBgColor(AppStorage.Get('AllFolderArray'), this.noteItem.folder_uuid))
Text() {
ForEach(this.spans.map((item1, index1) => {
@ -207,68 +230,76 @@ export struct NoteItemComp {
if (item.data.type == 0) {
Span(item.data.text)
.fontColor($r("app.color.note_title_font_color"))
.fontSize(this.portraitModel ? 16 : '8lpx')
.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(this.portraitModel ? 16 : '8lpx')
.fontSize(16)
.fontWeight(FontWeight.Medium)
}
},
item => item.index)
}.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
Row({ space: 4 }) {
Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time)))
.fontSize(this.portraitModel ? 14 : '7lpx')
.maxLines(1)
.fontSize(14)
.fontColor($r("app.color.list_modified_time_font_color"))
.fontWeight(FontWeight.Regular)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Image($r("app.media.favorite"))
.height(this.portraitModel ? 16 : '8lpx')
.width(this.portraitModel ? 16 : '8lpx')
.height(16)
.width(16)
.visibility(this.noteItem.is_favorite == Favorite.Yes ? Visibility.Visible : Visibility.None)
Image($r("app.media.topped"))
.height(this.portraitModel ? 16 : '8lpx')
.width(this.portraitModel ? 16 : '8lpx')
.height(16)
.width(16)
.visibility(this.noteItem.is_top == Top.Yes ? Visibility.Visible : Visibility.None)
}
.padding({ left: this.portraitModel ? 12 : '6lpx' })
.padding({ left: 12 })
}.alignItems(HorizontalAlign.Start)
}.flexShrink(1)
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Stack({ alignContent: Alignment.Center }) {
Image(this.noteItem.content_img)
.height(this.portraitModel ? 47 : '23.5lpx')
.width(this.portraitModel ? 47 : '23.5lpx')
.borderRadius(this.portraitModel ? 12 : '6lpx')
.border({ width: this.portraitModel ? 0.5 : '0.25lpx', color: '#19182431' })
.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(this.portraitModel ? 24 : '12lpx')
.width(this.portraitModel ? 24 : '12lpx')
.height(24)
.width(24)
Image($r("app.media.checked"))
.width(this.portraitModel ? 24 : '12lpx')
.height(this.portraitModel ? 24 : '12lpx')
.width(24)
.height(24)
.visibility(NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem) ? Visibility.Visible : Visibility.None)
}.width(this.portraitModel ? 24 : '12lpx')
.height(this.portraitModel ? 24 : '12lpx')
}.width(24)
.height(24)
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
}
.flexShrink(0)
.height(this.portraitModel ? 48 : '24lpx')
.width(this.longpress ? this.portraitModel ? 80 : '40lpx' : this.portraitModel ? 48 : '24lpx')
.height(48)
.width(this.longpress ? 80 : 48)
}
.width('100%')
.height(this.portraitModel ? 72 : '36lpx')
.padding({ left: this.portraitModel ? 16 : '8lpx', right: this.portraitModel ? 12 : '6lpx', top: this.portraitModel ? 4 : '2lpx', bottom: this.portraitModel ? 4 : '2lpx' })
.borderRadius(this.portraitModel ? 24 : '12lpx')
.height(72)
.padding({
left: 16,
right: 12,
top: 4,
bottom: 4
})
.borderRadius(24)
.linearGradient({
direction: GradientDirection.Right,
colors: this.selectedNoteData.uuid == this.noteItem.uuid ? [[0xffcdae, 0.0], [0xFfece2, 1.0]] : [[0xffffff, 0.0], [0xffffff, 1.0]]
@ -327,7 +358,7 @@ export struct NoteItemComp {
@Component
export struct NoteItemListComp {
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('Longpress') longpress: boolean
@ -372,7 +403,7 @@ export struct NoteItemListComp {
.visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible)
Stack() {
Flex({direction: FlexDirection.Column}) {
Flex({ direction: FlexDirection.Column }) {
Flex({ justifyContent: FlexAlign.Center }) {
Text($r("app.string.permanently_delete_tips"))
.fontSize(12)
@ -445,8 +476,8 @@ export struct NoteItemListComp {
@Component
export struct OperateNoteComp {
@Consume('Longpress') longpress: boolean
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') refreshFlag: number
@Consume('SelectedNoteData') selectedNoteData: NoteData
@ -597,7 +628,7 @@ export struct OperateNoteComp {
.onClick(() => {
if (this.CheckedNoteArray.length <
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
.length) {
.length) {
NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid))
} else {
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
@ -613,7 +644,7 @@ export struct OperateNoteComp {
@Component
export struct AddNoteComp {
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('Longpress') longpress: boolean
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('SelectedNoteData') selectedNoteData: NoteData
@ -633,9 +664,9 @@ export struct AddNoteComp {
.onClick(() => {
let noteData
if (this.selectedFolderData.uuid == SysDefFolderUuid.AllNotes || this.selectedFolderData.uuid == SysDefFolderUuid.MyFavorites) {
noteData = new NoteData(0, "标题", new Date().getTime() + "", SysDefFolderUuid.UnClassified, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0,0)
noteData = new NoteData(0, "标题", new Date().getTime() + "", SysDefFolderUuid.UnClassified, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0, 0)
} else {
noteData = new NoteData(0, "标题", new Date().getTime() + "", this.selectedFolderData.uuid, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0,0)
noteData = new NoteData(0, "标题", new Date().getTime() + "", this.selectedFolderData.uuid, "", "", NoteType.SysDef, Top.No, Favorite.No, Delete.No, new Date().getTime(), new Date().getTime(), 0, 0)
}
this.AllNoteArray.push(noteData)
@ -690,10 +721,10 @@ export struct SearchComp {
.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, top:1 })
.padding({left:6})
.padding({ left: 6, top: 1 })
.padding({ left: 6 })
.onEditChange((isEditing: boolean) => {
// this.search = isEditing
// this.search = isEditing
})
.onChange((value: string) => {
if (!this.longpress) {
@ -709,14 +740,14 @@ export struct SearchComp {
this.search = true
}
})
// whether the focus is on the search input before coutinue
// whether the focus is on the search input before coutinue
.onFocus(() => {
this.isFocusOnSearch = true
})
.onBlur(() => {
this.isFocusOnSearch = false
})
// key for request focus after coutinue
// key for request focus after coutinue
.key('searchInput')
.restoreId(3)
}
@ -734,8 +765,8 @@ export struct SearchComp {
@Component
export struct OperateNoteCompForPortrait {
@Consume('Longpress') longpress: boolean
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Consume('SelectedFolderData') selectedFolderData: FolderData
@Consume('RefreshFlag') @Watch('opacityChange') refreshFlag: number
@Consume('SelectedNoteData') selectedNoteData: NoteData
@ -862,7 +893,7 @@ export struct OperateNoteCompForPortrait {
.fontColor($r("app.color.delete_font_color"))
.padding({ top: 5 })
}
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : "25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
@ -931,7 +962,7 @@ export struct OperateNoteCompForPortrait {
.fontColor($r("app.color.recover_font_color"))
.padding({ top: 5 })
}
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : "25%")
.height("100%")
.opacity(this.greyOpacity ? 0.4 : 1)
.enabled(this.greyOpacity ? false : true)
@ -947,7 +978,7 @@ export struct OperateNoteCompForPortrait {
.onClick(() => {
if (this.CheckedNoteArray.length <
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
.length) {
.length) {
NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid))
} else {
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
@ -959,7 +990,7 @@ export struct OperateNoteCompForPortrait {
.fontColor($r("app.color.check_all_font_color"))
.padding({ top: 5 })
}
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes? 120 :"25%")
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : "25%")
.height("100%")
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)

View File

@ -18,7 +18,7 @@
"name": "component",
"type": "har",
"deviceTypes": [
"phone",
"default",
"tablet"
],
"uiSyntax": "ets"

787
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,10 @@
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/hvigor": "1.0.6",
"@ohos/hvigor-ohos-plugin": "1.0.6",
"@ohos/hvigor": "1.2.2",
"@ohos/hvigor-ohos-plugin": "1.2.2",
"hypium": "^1.0.0",
"js-base64": "^3.7.2"
"js-base64": "^3.7.2",
"@ohos/hypium": "1.0.2"
}
}

View File

@ -1,11 +1,11 @@
{
"name": "phone",
"name": "default",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/component": {
"version": "file:../../common/component",
"version": "file:../../features",
"requires": {
"@ohos/source": "file:../../common/resources",
"@ohos/utils": "file:../../common/utils"

View File

@ -0,0 +1,19 @@
{
"license": "ISC",
"devDependencies": {},
"name": "default",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/utils": "file:../../common/utils",
"@ohos/component": "file:../../features",
"@ohos/source": "file:../../common/resources"
}
}

View File

@ -20,7 +20,11 @@ import fileio from '@ohos.fileio'
import inputMethod from '@ohos.inputmethod';
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { atob } from 'js-base64'
import display from '@ohos.display';
globalThis.rdbStore = undefined
export default class MainAbility extends Ability {
private Tag = "MainAbility_Tablet"
@ -65,6 +69,28 @@ export default class MainAbility extends Ability {
}
onWindowStageCreate(windowStage) {
let displayClass = null
let screenDpi = null
displayClass = display.getDefaultDisplaySync()
screenDpi = displayClass.densityDPI
windowStage.getMainWindow((err, data) => {
let windowClass = data
try {
windowClass.on('windowSizeChange', (data) => {
let windowWidth = data.width / (screenDpi / 160)
if (windowWidth >= 320 && windowWidth < 520 || windowWidth < 320) {
AppStorage.SetOrCreate('breakPoint', 'sm')
} else if (windowWidth >= 520 && windowWidth < 840) {
AppStorage.SetOrCreate('breakPoint', 'md')
} else if (windowWidth >= 840) {
AppStorage.SetOrCreate('breakPoint', 'lg')
}
})
} catch (exception) {
LogUtil.info(this.Tag, 'windowSizeChange fail')
}
})
LogUtil.info(this.Tag, " onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/MyNoteHome", null)
}
@ -135,7 +161,7 @@ export default class MainAbility extends Ability {
return AbilityConstant.OnContinueResult.AGREE
}
getSrcFromHtml(html: string): any{
getSrcFromHtml(html: string): any {
let srcArray = []
if (html == undefined || html == null || html == "") {
return srcArray

View File

@ -15,9 +15,9 @@
import fileio from '@ohos.fileio'
import deviceInfo from '@ohos.deviceInfo';
import {NoteHomeComp} from './NoteHome'
import {NoteHomePortraitComp} from './NoteHomePortrait'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { NoteHomeComp } from './NoteHome'
import { NoteHomePortraitComp } from './NoteHomePortrait'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
import inputMethod from '@ohos.inputmethod';
@ -27,16 +27,25 @@ import router from '@system.router';
@Component
export struct MyNoteHomeComp {
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
@Provide('PortraitModel') portraitModel: boolean = (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default')
@Provide('PortraitModel') portraitModel: boolean = true
@Provide('RefreshFlag') refreshFlag: number = 0
private controllerShow: WebController = new WebController()
private context = getContext(this)
TAG = "MyNoteHomeComp_Tablet"
@StorageLink('breakPoint')@Watch('onBreakPointChange') breakPoints: string = 'lg'
onBreakPointChange(){
if(this.breakPoints == 'sm'){
this.portraitModel = true
}else{
this.portraitModel = false
}
}
build() {
Row() {
if (this.dBQueryFinished == 1) {
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
if (this.breakPoints == 'sm') {
NoteHomePortraitComp()
} else {
NoteHomeComp({ controllerShow: this.controllerShow })
@ -48,9 +57,9 @@ export struct MyNoteHomeComp {
.height('100%')
}
aboutToAppear(): void{
aboutToAppear(): void {
LogUtil.info(this.TAG, "aboutToAppear")
this.breakPoints = AppStorage.Get('breakPoint')
if (this.context == undefined || this.context == null) {
LogUtil.warn(this.TAG, "context is error")
return
@ -95,22 +104,22 @@ export struct MyNoteHomeComp {
}
if (!dbExist) {
dbPath = context.databaseDir + "/rdb/note.db"
try{
try {
fileio.accessSync(dbPath)
LogUtil.info(this.TAG,"db has created")
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
} catch (err) {
LogUtil.info(this.TAG,"db has not created, start to create db")
LogUtil.info(this.TAG, "db has not created, start to create db")
RdbStoreUtil.createRdbStore(this.context)
}
}
}
aboutToDisappear(): void{
aboutToDisappear(): void {
LogUtil.info(this.TAG, "aboutToDisappear")
}
onPageShow(): void{
onPageShow(): void {
LogUtil.info(this.TAG, "onPageShow")
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
// continue from tablet
@ -127,7 +136,7 @@ export struct MyNoteHomeComp {
let needRefresh = AppStorage.Get<boolean>('needRefresh')
if (currentNote != null && needRefresh == true) {
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + currentNote.content_text + "')" })
AppStorage.SetOrCreate<boolean>('needRefresh',false)
AppStorage.SetOrCreate<boolean>('needRefresh', false)
}
}

View File

@ -14,9 +14,9 @@
*/
import deviceInfo from '@ohos.deviceInfo';
import {NoteContentCompPortrait} from '@ohos/component/src/main/ets/components/NoteContentCompPortrait'
import {NoteContent} from '@ohos/component/src/main/ets/components/NoteContent'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { NoteContentCompPortrait } from '@ohos/component/src/main/ets/components/NoteContentCompPortrait'
import { NoteContent } from '@ohos/component/src/main/ets/components/NoteContent'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import inputMethod from '@ohos.inputmethod'
@ -26,13 +26,14 @@ struct NoteContentHome {
@Provide('RefreshFlag') refreshFlag: number = 0
private controllerShow: WebController = new WebController()
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
@StorageLink('breakPoint') breakPoints: string = 'lg'
TAG = "NoteContentHome_Tablet"
build() {
// Note content display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
if (this.dBQueryFinished == 1) {
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
if (this.breakPoints == 'sm') {
NoteContentCompPortrait({ controllerShow: this.controllerShow })
} else {
NoteContent({ controllerShow: this.controllerShow })
@ -45,16 +46,17 @@ struct NoteContentHome {
.height('100%')
}
onBackPress():void{
LogUtil.info(this.TAG, "onBackPress")
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
if (deviceInfo.deviceType !== 'phone' && deviceInfo.deviceType !== 'default') {
inputMethod.getInputMethodController().stopInput()
}
onBackPress(): void {
LogUtil.info(this.TAG, "onBackPress")
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
if (deviceInfo.deviceType !== 'phone' && deviceInfo.deviceType !== 'default') {
inputMethod.getInputMethodController().stopInput()
}
}
aboutToAppear(): void{
aboutToAppear(): void {
this.breakPoints = AppStorage.Get('breakPoint')
LogUtil.info(this.TAG, "aboutToAppear")
let isContinue = AppStorage.Get<boolean>('IsContinue')
LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue)
@ -65,5 +67,4 @@ struct NoteContentHome {
AppStorage.SetOrCreate<boolean>('NoteContentHomeExist', true)
}
}
}

View File

@ -0,0 +1,173 @@
/*
* 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 { FolderListComp, FolderListBackGround } from '@ohos/component/src/main/ets/components/FolderListComp'
import { NoteListComp } from '@ohos/component/src/main/ets/components/NoteListComp'
import { NoteContentComp } from '@ohos/component/src/main/ets/components/NoteContentComp'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { circleColorArray } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
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 } from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import LayoutUtil from '@ohos/utils/src/main/ets/default/baseUtil/LayoutUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import mediaquery from '@ohos.mediaquery'
@Entry
@Component
export struct NoteHomeComp {
// 当前文件夹、笔记、分栏
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')
@Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section')
@Provide('SelectedColor') selectedColor: string = circleColorArray[0]
@Provide('LastSectionStatus') lastSectionStatus: number = 3 // 记录分栏上一次的状态
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
@Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开
@Provide('Search') search: boolean = false // 是否处于搜索状态
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
@Provide('SelectedAll') selectedAll: boolean = false
@Provide('EditModel') editModel: boolean = false //编辑模式:临时方案
@Provide('Issave') issave: number = 0
@StorageLink('breakPoint') breakPoints: string = 'lg'
controllerShow: WebController
TAG = "NoteHomeComp_Tablet"
build() {
Flex({ justifyContent: FlexAlign.Start }) {
if (this.breakPoints === 'lg') {
// Folder list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
FolderListComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5"))
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.folderListVisibility == 0 ? Visibility.None : Visibility.Visible)
.enabled(this.search ? false : true)
// Note list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteListComp({ controllerShow: this.controllerShow })
}
.flexShrink(1)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.layoutWeight(2)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.noteListVisibility == 0 ? Visibility.None : Visibility.Visible)
// Note content display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteContentComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.layoutWeight(this.sectionStatus != 1 ? 3 : null)
.height(StyleConstants.PERCENTAGE_100)
.enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true)
} else if (this.breakPoints === 'md') {
Stack({ alignContent: Alignment.Start }) {
Row() {
// Note list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteListComp({ controllerShow: this.controllerShow })
}
.flexShrink(1)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.layoutWeight(2)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.noteListVisibility == 0 ? Visibility.None : Visibility.Visible)
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteContentComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.layoutWeight(this.sectionStatus != 1 ? 3 : null)
.height(StyleConstants.PERCENTAGE_100)
.enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true)
}
//Folder list display area
Stack() {
FolderListBackGround()
FolderListComp()
}
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible)
}
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
}
}
.width(StyleConstants.PERCENTAGE_100)
.height(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void {
LogUtil.info(this.TAG, "aboutToAppear")
let isContinue = AppStorage.Get<boolean>('IsContinue')
LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue)
if (isContinue) {
this.sectionStatus = AppStorage.Get('Section')
}
// continue from phone
let continueFromPhone = AppStorage.Get<boolean>('ContinueFromPhone')
LogUtil.info(this.TAG, "aboutToAppear, continueFromPhone : " + continueFromPhone)
if (continueFromPhone) {
this.sectionStatus = 3
}
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(this.TAG, "aboutToAppear, set continue section success")
}
aboutToDisappear(): void {
LogUtil.info(this.TAG, "aboutToDisappear")
}
}

View File

@ -37,7 +37,7 @@ export struct NoteHomePortraitComp {
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
// 分栏状态
@Provide('ExpandStatus') expandStatus: boolean = AppStorage.Get<boolean>('Expand') // 笔记本折叠展开状态
@Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = AppStorage.Get<boolean>('Choose') // 是否选择笔记进行打开
@Provide('Search') search: boolean = false // 是否处于搜索状态

View File

@ -13,9 +13,10 @@
* limitations under the License.
*/
{
"module": {
"name": "tablet",
"name": "default",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_MainAbility",

View File

@ -1,18 +0,0 @@
{
"license":"ISC",
"devDependencies":{},
"name":"phone",
"ohos":{
"org":"huawei",
"directoryLevel":"module",
"buildTool":"hvigor"
},
"description":"example description",
"repository":{},
"version":"1.0.0",
"dependencies":{
"@ohos/utils":"file:../../common/utils",
"@ohos/component":"file:../../common/component",
"@ohos/source":"file:../../common/resources"
}
}

View File

@ -1,130 +0,0 @@
/*
* 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 Ability from '@ohos.application.Ability'
import AbilityConstant from '@ohos.application.AbilityConstant'
import fileio from '@ohos.fileio'
import inputMethod from '@ohos.inputmethod'
globalThis.rdbStore = undefined
export default class MainAbility extends Ability {
private Tag = "MainAbility_Phone"
onCreate(want, launchParam) {
console.info(this.Tag + " onCreate, launchReason is " + launchParam.launchReason)
AppStorage.SetOrCreate<boolean>('Expand', false)
AppStorage.SetOrCreate<boolean>('Choose', true)
if (launchParam.launchReason == 3) {
// 设置迁移标记
AppStorage.SetOrCreate<boolean>('IsContinue', true)
// 获取对端的迁移数据
let continueNote: string = want.parameters["ContinueNote"]
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
// 来自手机的迁移
let continueChoose: boolean = want.parameters["ContinueChoose"]
if (continueChoose) {
console.info(this.Tag + " continue from phone")
}else{
AppStorage.SetOrCreate<boolean>('ContinueFromTablet', true)
console.info(this.Tag + " continue from tablet")
}
this.context.restoreWindowStage(null)
}
globalThis.noteContext = this.context
}
onDestroy() {
console.info(this.Tag + " onDestroy")
}
onWindowStageCreate(windowStage) {
console.info(this.Tag + " onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/MyNoteHome", null)
}
onWindowStageDestroy() {
console.info(this.Tag + " onWindowStageDestroy")
}
onForeground() {
console.info(this.Tag + " onForeground")
}
onBackground() {
console.info(this.Tag + " onBackground")
// 退出键盘
inputMethod.getInputMethodController().stopInput();
}
onContinue(wantParam: { [key: string]: any }) {
console.info(this.Tag + " onContinue")
// 获取本端的迁移数据
let continueNote = AppStorage.Get<string>('ContinueNote')
if (continueNote == undefined || continueNote == null) {
console.info(this.Tag + " onContinue, continueNote is error, default [0]")
continueNote = JSON.stringify(AppStorage.Get('AllNoteArray')[0].toNoteObject())
}
// 保存本端的迁移数据
wantParam["ContinueNote"] = continueNote
wantParam["ContinueChoose"] = true
// save img to DisFileDir
console.info(this.Tag + " onContinue, save img to DisFileDir")
let continueNoteObj = JSON.parse(continueNote)
let srcArray = this.getSrcFromHtml(continueNoteObj.content_text)
srcArray.forEach((src: string) => {
let lastIndex = src.lastIndexOf('/')
if (lastIndex != -1) {
let imgName = src.substring(lastIndex + 1)
this.writeToDisFileDir(imgName)
}
})
console.info(this.Tag + " onContinue end")
return AbilityConstant.OnContinueResult.AGREE;
}
getSrcFromHtml(html: string): any{
let srcArray = []
if (html == undefined || html == null || html == "") {
return srcArray
}
let imgReg = /<img[^>]+>/g
let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i
let imgArray = html.match(imgReg)
if (imgArray != null) {
for (let i = 0; i < imgArray.length; i++) {
let src = imgArray[i].match(srcReg)
if (src != null && src.length > 1) {
srcArray.push(src[1])
}
}
}
return srcArray
}
writeToDisFileDir(fileName: string) {
console.info(this.Tag + " writeToDisFileDir, fileName : " + fileName)
let filesDir = this.context.filesDir
let srcPath = filesDir + "/" + fileName
let distributedFilesDir = this.context.distributedFilesDir
let desPath = distributedFilesDir + "/" + fileName
try {
fileio.copyFileSync(srcPath, desPath)
console.info(this.Tag + " onContinue, writeToDisFileDir, copyFile successfully")
} catch (err) {
console.warn(this.Tag + " onContinue, writeToDisFileDir, copyFile failed : " + err)
}
}
}

View File

@ -1,116 +0,0 @@
/*
* 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 fileio from '@ohos.fileio'
import bundle from '@ohos.bundle'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import {NoteHomePortraitComp} from './NoteHomePortrait'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
import inputMethod from '@ohos.inputmethod'
import router from '@system.router'
@Entry
@Component
export struct MyNoteHomeComp {
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
@Provide('PortraitModel') portraitModel: boolean = true
@Provide('RefreshFlag') refreshFlag: number = 0
private context = getContext(this)
TAG = "MyNoteHomeComp_Phone"
build() {
Flex() {
if (this.dBQueryFinished == 1) {
NoteHomePortraitComp()
}
}
.width('100%').height('100%')
}
aboutToAppear(): void{
LogUtil.info(this.TAG, "aboutToAppear")
if (this.context == undefined || this.context == null) {
LogUtil.warn(this.TAG, "context is error")
return
}
let permissionList: Array<string> = [
"ohos.permission.READ_MEDIA",
"ohos.permission.MEDIA_LOCATION",
"ohos.permission.DISTRIBUTED_DATASYNC"
]
LogUtil.info(this.TAG, 'permissions need to require from user')
let context: any = getContext(this);
context.requestPermissionsFromUser(permissionList).then((data) => {
LogUtil.info(this.TAG, 'data permissions : ' + data.permissions)
LogUtil.info(this.TAG, 'data result: ' + data.authResults)
let sum = 0
for (let i = 0; i < data.authResults.length; i++) {
sum += data.authResults[i]
}
LogUtil.info(this.TAG, 'request permissions sum: ' + sum)
}, (err) => {
LogUtil.warn(this.TAG, 'failed to requestPermissionsFromUser : ' + err.code);
})
let dbExist = false;
let dbPath = context.databaseDir + "/db/note.db"
try {
fileio.accessSync(dbPath)
LogUtil.info(this.TAG, "db has created")
RdbStoreUtil.initAppStorage(this.context)
dbExist = true
} catch (err) {
LogUtil.info(this.TAG, "db has not created, find to rdb folder")
}
if (!dbExist) {
dbPath = context.databaseDir + "/rdb/note.db"
try{
fileio.accessSync(dbPath)
LogUtil.info(this.TAG,"db has created")
RdbStoreUtil.initAppStorage(this.context)
} catch (err) {
LogUtil.info(this.TAG,"db has not created, start to create db")
RdbStoreUtil.createRdbStore(this.context)
}
}
}
aboutToDisappear(): void{
LogUtil.info(this.TAG, "aboutToDisappear")
}
onPageShow(): void{
LogUtil.info(this.TAG, "onPageShow")
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
// continue from tablet
let continueFromTablet = AppStorage.Get<boolean>('ContinueFromTablet')
LogUtil.info(this.TAG, "onPageShow, continueFromTablet : " + continueFromTablet)
let noteContentHomeExist = AppStorage.Get<boolean>('NoteContentHomeExist')
LogUtil.info(this.TAG, "onPageShow, noteContentHomeExist : " + noteContentHomeExist)
if (continueFromTablet && !noteContentHomeExist) {
router.push({ uri: 'pages/NoteContentHome' })
AppStorage.SetOrCreate<boolean>('ContinueFromTablet', false)
}
}
onBackPress():void{
LogUtil.info(this.TAG, "onBackPress")
// 退出键盘
inputMethod.getInputMethodController().stopInput();
}
}

View File

@ -1,56 +0,0 @@
/*
* 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 {NoteContentCompPortrait} from '@ohos/component/src/main/ets/components/NoteContentCompPortrait'
import {LogUtil} from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
@Entry
@Component
struct NoteContentHome {
@Provide('RefreshFlag') refreshFlag: number = 0
private controllerShow: WebController = new WebController()
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
TAG = "NoteContentHome_Phone"
build() {
// Note content display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
if (this.dBQueryFinished == 1) {
NoteContentCompPortrait({ controllerShow: this.controllerShow })
}
}
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.width('100%')
.height('100%')
}
onBackPress():void{
LogUtil.info(this.TAG, "onBackPress")
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
}
aboutToAppear(): void{
LogUtil.info(this.TAG, "aboutToAppear")
let isContinue = AppStorage.Get<boolean>('IsContinue')
LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue)
if (isContinue) {
RdbStoreUtil.initAppStorage(globalThis.noteContext)
}
AppStorage.SetOrCreate<boolean>('NoteContentHomeExist', true)
}
}

View File

@ -1,81 +0,0 @@
/*
* 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 { FolderListComp, FolderListBackGround } from '@ohos/component/src/main/ets/components/FolderListComp'
import { NoteListComp } from '@ohos/component/src/main/ets/components/NoteListComp'
import { NoteContentCompPortrait } from '@ohos/component/src/main/ets/components/NoteContentCompPortrait'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { circleColorArray } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
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 } from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import LayoutUtil from '@ohos/utils/src/main/ets/default/baseUtil/LayoutUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
@Entry
@Component
export struct NoteHomePortraitComp {
// 当前文件夹、笔记、分栏
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')
@Provide('SectionStatus') sectionStatus: number = 1; // 表示分栏状态, 3表示三分栏 2表示二分栏1表示一分栏
@Provide('LastSectionStatus') lastSectionStatus: number = 1; // 记录分栏上一次的状态
@Provide('SelectedColor') selectedColor: string = circleColorArray[0];
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
// 分栏状态
@Provide('ExpandStatus') expandStatus: boolean = AppStorage.Get<boolean>('Expand') // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = AppStorage.Get<boolean>('Choose') // 是否选择笔记进行打开
@Provide('Search') search: boolean = false // 是否处于搜索状态
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
@Provide('SelectedAll') selectedAll: boolean = false;
@Provide('EditModel') editModel: boolean = false
TAG = "NoteHomePortraitComp_Phone"
build() {
Stack({ alignContent: Alignment.Start }) {
// Note list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
NoteListComp()
}
.width(StyleConstants.PERCENTAGE_100)
.height(StyleConstants.PERCENTAGE_100)
.enabled(this.expandStatus ? false : true)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
//Folder list display area
Stack() {
FolderListBackGround()
FolderListComp()
}
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible)
}
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void{
LogUtil.info(this.TAG, "aboutToAppear")
}
aboutToDisappear(): void{
LogUtil.info(this.TAG, "aboutToDisappear")
}
}

View File

@ -1,71 +0,0 @@
/*
* 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": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_MainAbility",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
],
"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "$string:read_media_permission"
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "$string:media_location_permission"
},
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "$string:distributed_dataSync_permission"
},
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:entry_MainAbility",
"icon": "$media:note",
"label": "$string:entry_MainAbility",
"visible": true,
"continuable": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"startWindowBackground": "$color:color_1",
"startWindowIcon": "$media:note"
}
]
}
}

View File

@ -1,20 +0,0 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "备忘录"
},
{
"name": "read_media_permission",
"value": "Used to read media file information in external storage of users"
},
{
"name": "media_location_permission",
"value": "Used for memo access to geographic location information in user media files"
},
{
"name": "distributed_dataSync_permission",
"value": "Used for memo data exchange between different equipment"
}
]
}

View File

@ -1,7 +0,0 @@
{
"src": [
"pages/MyNoteHome",
"pages/NoteContentHome",
"pages/NoteHomePortrait"
]
}

View File

@ -1,16 +0,0 @@
{
"string": [
{
"name": "read_media_permission",
"value": "用于备忘录读取用户外部存储中的媒体文件信息"
},
{
"name": "media_location_permission",
"value": "用于备忘录访问用户媒体文件中的地理位置信息"
},
{
"name": "distributed_dataSync_permission",
"value": "用于备忘录进行不同设备间的数据交换"
}
]
}

View File

@ -1,3 +0,0 @@
/node_modules
/.preview
/build

View File

@ -1,2 +0,0 @@
// 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').hapTasks

View File

@ -1,45 +0,0 @@
{
"name": "tablet",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/component": {
"version": "file:../../common/component",
"requires": {
"@ohos/source": "file:../../common/resources",
"@ohos/utils": "file:../../common/utils"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
},
"@ohos/utils": {
"version": "file:../../common/utils",
"requires": {
"@ohos/source": "file:../../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
}
}
}
}
},
"@ohos/source": {
"version": "file:../../common/resources"
},
"@ohos/utils": {
"version": "file:../../common/utils",
"requires": {
"@ohos/source": "file:../../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
}
}
}
}
}

View File

@ -1,18 +0,0 @@
{
"license":"ISC",
"devDependencies":{},
"name":"tablet",
"ohos":{
"org":"huawei",
"directoryLevel":"module",
"buildTool":"hvigor"
},
"description":"example description",
"repository":{},
"version":"1.0.0",
"dependencies":{
"@ohos/utils":"file:../../common/utils",
"@ohos/component":"file:../../common/component",
"@ohos/source":"file:../../common/resources"
}
}

View File

@ -1,7 +0,0 @@
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}

View File

@ -1,135 +0,0 @@
/*
* 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 { FolderListComp } from '@ohos/component/src/main/ets/components/FolderListComp'
import { NoteListComp } from '@ohos/component/src/main/ets/components/NoteListComp'
import { NoteContentComp } from '@ohos/component/src/main/ets/components/NoteContentComp'
import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { circleColorArray } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
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 } from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData'
import LayoutUtil from '@ohos/utils/src/main/ets/default/baseUtil/LayoutUtil'
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
import mediaquery from '@ohos.mediaquery'
@Entry
@Component
export struct NoteHomeComp {
// 当前文件夹、笔记、分栏
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')
@Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section')
@Provide('SelectedColor') selectedColor: string = circleColorArray[0]
@Provide('LastSectionStatus') lastSectionStatus: number = 3 // 记录分栏上一次的状态
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
@Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开
@Provide('Search') search: boolean = false // 是否处于搜索状态
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
@Provide('SelectedAll') selectedAll: boolean = false
@Provide('EditModel') editModel: boolean = false //编辑模式:临时方案
@Provide('Issave') issave: number = 0
controllerShow: WebController
TAG = "NoteHomeComp_Tablet"
narrowWinListener = mediaquery.matchMediaSync('(width < 2000)')
onWinSizeChange(mediaQueryResult) {
if (this.sectionStatus != 1) {
this.sectionStatus = (mediaQueryResult.matches) ? 2 : 3
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(this.TAG, "onWinSizeChange, set continue section success")
}
}
build() {
Flex({ justifyContent: FlexAlign.Start }) {
// Folder list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
FolderListComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5"))
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.folderListVisibility == 0 ? Visibility.None : Visibility.Visible)
.enabled(this.search ? false : true)
// Note list display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteListComp({ controllerShow: this.controllerShow })
}
.flexShrink(1)
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
.layoutWeight(2)
.height(StyleConstants.PERCENTAGE_100)
.visibility(
LayoutUtil.getWidthWeightMessage(this.sectionStatus)
.noteListVisibility == 0 ? Visibility.None : Visibility.Visible)
// Note content display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
Divider()
.vertical(true)
.strokeWidth(1)
.color($r("app.color.divider_color_182431"))
.height("100%")
.opacity(StyleConstants.OPACITY_10)
NoteContentComp({ controllerShow: this.controllerShow })
}
.flexShrink(0)
.backgroundColor($r("app.color.notecontent_color_ffffff"))
.layoutWeight(this.sectionStatus != 1 ? 3 : null)
.height(StyleConstants.PERCENTAGE_100)
.enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true)
}
.width(StyleConstants.PERCENTAGE_100)
.height(StyleConstants.PERCENTAGE_100)
}
aboutToAppear(): void{
LogUtil.info(this.TAG, "aboutToAppear")
this.narrowWinListener.on('change', this.onWinSizeChange.bind(this))
this.sectionStatus = this.narrowWinListener.matches ? 2 : 3
let isContinue = AppStorage.Get<boolean>('IsContinue')
LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue)
if (isContinue) {
this.sectionStatus = AppStorage.Get('Section')
}
// continue from phone
let continueFromPhone = AppStorage.Get<boolean>('ContinueFromPhone')
LogUtil.info(this.TAG, "aboutToAppear, continueFromPhone : " + continueFromPhone)
if (continueFromPhone) {
this.sectionStatus = 3
}
// save continue data
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
LogUtil.info(this.TAG, "aboutToAppear, set continue section success")
}
aboutToDisappear(): void{
LogUtil.info(this.TAG, "aboutToDisappear")
}
}

View File

@ -1,8 +0,0 @@
{
"color": [
{
"name": "color_1",
"value": "#fff"
}
]
}