• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { FolderListComp } from '@ohos/component/src/main/ets/components/FolderListComp'
17import { NoteListComp } from '@ohos/component/src/main/ets/components/NoteListComp'
18import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants'
19import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
20import { circleColorArray } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
21import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData'
22import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
23
24@Entry
25@Component
26export struct NoteHomePortraitComp {
27  // 当前文件夹、笔记、分栏
28  @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')!;
29  @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')!;
30  @Provide('SectionStatus') sectionStatus: number = 1; // 表示分栏状态, 3表示三分栏, 2表示二分栏,1表示一分栏
31  @Provide('LastSectionStatus') lastSectionStatus: number = 1; // 记录分栏上一次的状态
32  @Provide('SelectedColor') selectedColor: string = circleColorArray[0];
33  @Provide('Longpress') longpress: boolean = false // 第二栏长按状态
34
35  // 分栏状态
36  @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
37  @Provide('ChooseNote') chooseNote: boolean = AppStorage.Get<boolean>('Choose')!; // 是否选择笔记进行打开
38
39  @Provide('Search') search: boolean = false // 是否处于搜索状态
40  @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
41  @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
42  @Provide('SelectedAll') selectedAll: boolean = false;
43  @Provide('EditModel') editModel: boolean = false
44  TAG = "NoteHomePortraitComp_Phone"
45  @Provide('AsideWidth') asideWidth: number = 200
46
47  build() {
48    Stack({ alignContent: Alignment.Start }) {
49      // Note list display area
50      Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
51        NoteListComp()
52      }
53      .width(StyleConstants.PERCENTAGE_100)
54      .height(StyleConstants.PERCENTAGE_100)
55      .enabled(this.expandStatus ? false : true)
56      .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
57
58      // 蒙层
59      if (this.expandStatus) {
60        Column()
61          .width('100%')
62          .height('100%')
63          .position({ x: 0, y: 0 })
64          .backgroundColor(Color.Black)
65          .opacity(0.2)
66          .transition({ opacity: 0 })
67      }
68      //Folder list display area
69      Column() {
70        FolderListComp()
71      }
72      .width(200)
73      .height(StyleConstants.PERCENTAGE_100)
74      .position({ x: 0, y: 0 })
75      .translate({ x: this.expandStatus ? 0 : '-200', y: 0 })
76    }
77    .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
78  }
79
80  aboutToAppear(): void {
81    LogUtil.info(this.TAG, "aboutToAppear")
82  }
83
84  aboutToDisappear(): void {
85    LogUtil.info(this.TAG, "aboutToDisappear")
86  }
87}