mirror of
https://github.com/openharmony/applications_notes.git
synced 2026-07-20 05:34:03 -04:00
@@ -3,3 +3,5 @@
|
||||
/.idea
|
||||
**/build
|
||||
/signature
|
||||
/.hvigor
|
||||
/package.json
|
||||
+16
-10
@@ -1,12 +1,10 @@
|
||||
# 备忘录部件
|
||||
## 简介
|
||||
|
||||
## 1. 项目介绍
|
||||
|
||||
备忘录应用是OpenHarmony中预置的应用,为用户提供文本编辑以及保存功能。
|
||||
|
||||
**架构图**
|
||||
|
||||

|
||||
|
||||
## 目录
|
||||
## 2. 目录结构
|
||||
```
|
||||
/applications/standard/note
|
||||
├─common
|
||||
@@ -47,10 +45,20 @@
|
||||
└─resources # 资源文件
|
||||
```
|
||||
|
||||
### 整体架构
|
||||
|
||||

|
||||
|
||||
## 3. 签名打包
|
||||
|
||||
## 编译构建/使用方法
|
||||
### 签名
|
||||
|
||||
#### 签名文件的获取
|
||||
|
||||
1.生成签名文件可参考https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/hapsigntool-overview.md
|
||||
|
||||
#### 签名文件的配置
|
||||
|
||||
打开项目工程,选择 File → Project Structure
|
||||
|
||||

|
||||
@@ -74,6 +82,7 @@
|
||||

|
||||
|
||||
|
||||
## 4. 安装、调试
|
||||
|
||||
### 应用安装
|
||||
|
||||
@@ -81,9 +90,6 @@
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
### 应用调试
|
||||
|
||||
#### log打印
|
||||
|
||||
+11
-19
@@ -13,32 +13,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
{
|
||||
"app": {
|
||||
"compileSdkVersion": 9,
|
||||
"compatibleSdkVersion": 9,
|
||||
"compatibleSdkVersion": 8,
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default"
|
||||
}
|
||||
],
|
||||
"signingConfigs": [
|
||||
]
|
||||
},
|
||||
"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 +44,13 @@
|
||||
"name": "utils",
|
||||
"srcPath": "./common/utils"
|
||||
},
|
||||
{
|
||||
"name": "component",
|
||||
"srcPath": "./common/component"
|
||||
},
|
||||
{
|
||||
"name": "resources",
|
||||
"srcPath": "./common/resources"
|
||||
},
|
||||
{
|
||||
"name": "component",
|
||||
"srcPath": "./features",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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": {
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
/build
|
||||
/package.json
|
||||
@@ -18,6 +18,7 @@
|
||||
"name": "resources",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"uiSyntax": "ets"
|
||||
|
||||
@@ -4,21 +4,37 @@
|
||||
<title>
|
||||
"editorJs"
|
||||
</title>
|
||||
<meta
|
||||
http-equiv="Content-Type"
|
||||
content="text/html; charset=UTF-8">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="editor_style.css">
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="editor_style.css">
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body onload="load()">
|
||||
<div
|
||||
id="editorjs"
|
||||
contenteditable="true">
|
||||
<div class="edit-box">
|
||||
|
||||
|
||||
<div id="editorjs" contenteditable="true"></div>
|
||||
<div class="button-box" id="buttonBox">
|
||||
<div id="addToDo">
|
||||
<img id="img1" src="icon/todo1.svg">
|
||||
<span id="lable1">清单</span>
|
||||
</div>
|
||||
<div id="chooseStyle">
|
||||
<img id="img2" src="icon/styles.svg">
|
||||
<span id="lable2">样式</span>
|
||||
</div>
|
||||
<div id="openAlbum">
|
||||
<img id="img3"src="icon/picture_white.svg">
|
||||
<span id="lable3">相册</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="rich_editor.js"></script>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="rich_editor.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -16,15 +16,12 @@
|
||||
html {
|
||||
height: 100%;
|
||||
font-family: sans-serif;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: scroll;
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
height: 100%;
|
||||
color: #333333;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -33,19 +30,20 @@ body {
|
||||
padding-left: 1px;
|
||||
padding-right: 24px;
|
||||
width: 100%;
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
outline: 0px solid transparent;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
color: #182431;
|
||||
opacity: 0.9;
|
||||
font-size: 16px;
|
||||
overflow: scroll;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#editorjs[placeholder]:empty:not(:focus):before {
|
||||
content: attr(placeholder);
|
||||
font-size: 16px;
|
||||
font-size: 24px;
|
||||
color: #9b9b9b;
|
||||
}
|
||||
|
||||
@@ -65,9 +63,9 @@ body {
|
||||
background-color: #ffffff;
|
||||
border: 2px solid #182431;
|
||||
opacity: 0.6;
|
||||
-webkit-border-radius: 50%;
|
||||
-webkit-appearance: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-border-radius: 50%;
|
||||
-webkit-appearance: none;
|
||||
-webkit-user-select: none;
|
||||
border-radius: 50%;
|
||||
font-size: 0.8rem;
|
||||
margin-left: 0px;
|
||||
@@ -78,7 +76,7 @@ body {
|
||||
padding: 0;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
-webkit-transition: background-color ease 0.1s;
|
||||
-webkit-transition: background-color ease 0.1s;
|
||||
transition: background-color ease 0.1s;
|
||||
vertical-align: top;
|
||||
cursor: default;
|
||||
@@ -91,3 +89,33 @@ body {
|
||||
color: #F88805;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.edit-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.button-box {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
background-color: white;
|
||||
display: none;
|
||||
justify-content: space-around;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.button-box div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.button-box img {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.button-box span {
|
||||
font-size: 20px;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>图片</title><path d="M8.25,7.25A1.75,1.75,0,1,1,6.5,9,1.75,1.75,0,0,1,8.25,7.25Zm9.11882,5.54816a1.06768,1.06768,0,0,0-.63408,0,2.29637,2.29637,0,0,0-.96559.71316l-2.75426,2.75414a2.25128,2.25128,0,0,1-3.18187.0001l-.11045-.11043a2.3173,2.3173,0,0,0-.84342-.63365L8.817,15.50159a1.06752,1.06752,0,0,0-.63408,0,2.29623,2.29623,0,0,0-.96557.71315L3.981,19.45191q.0346.05109.07168.09966l.00012.00339c.03269.0396.067.08112.10266.12117a.47644.47644,0,0,0,.03359.03877l-.03359-.03877q.0595.06672.12441.128L4.189,19.7149q.05584.05947.116.11459l-.02523-.02534a2.18793,2.18793,0,0,0,.47389.33886,4.23561,4.23561,0,0,0,2.171.35628L7.12777,20.5h9.74446a4.5924,4.5924,0,0,0,2.37406-.357,2.135,2.135,0,0,0,.89672-.89672,4.23561,4.23561,0,0,0,.35628-2.17095L20.5,16.87223V16.384l-.00025-.707-2.22541-2.2253a2.45615,2.45615,0,0,0-.81106-.62134l-.06248-.02213ZM6.91631,22a5.47979,5.47979,0,0,1-2.85738-.52273,3.703,3.703,0,0,1-1.5362-1.5362c-.05914-.11058-.11032-.21543-.15653-.32242L2.16986,19.164l.03321-.03465A8.915,8.915,0,0,1,2,16.87223V7.12777a5.8843,5.8843,0,0,1,.51223-3.03985l.022-.04161A3.63037,3.63037,0,0,1,3.95414,2.58517l.09217-.0509A5.79955,5.79955,0,0,1,7.12777,2h9.74446a5.88441,5.88441,0,0,1,3.03985.51223l.04161.022a3.63031,3.63031,0,0,1,1.46114,1.41987l.0509.09217A5.79955,5.79955,0,0,1,22,7.12777V13.642l-1.5-1.501V7.12777a4.5924,4.5924,0,0,0-.357-2.37406,2.135,2.135,0,0,0-.89672-.89672,4.23561,4.23561,0,0,0-2.17095-.35628L7.02454,3.50018l-.20148.00148A4.06394,4.06394,0,0,0,4.75371,3.857a2.135,2.135,0,0,0-.89672.89672A4.5924,4.5924,0,0,0,3.5,7.12777l.00017,9.84769.00149.20148c.00267.23112.00865.434.01841.61416l2.71111-2.71089a3.49937,3.49937,0,0,1,1.51668-1.01413,2.57567,2.57567,0,0,1,1.51463.00322l.08368.02679a3.64246,3.64246,0,0,1,1.43294.99429l.11406.114a.75112.75112,0,0,0,1.06134.00014L14.783,12.37678a3.49944,3.49944,0,0,1,1.51669-1.01413,2.56723,2.56723,0,0,1,1.50427,0,3.52054,3.52054,0,0,1,1.5271,1.02443L22,15.05581v2.02788a5.47979,5.47979,0,0,1-.52273,2.85738,3.703,3.703,0,0,1-1.5362,1.5362,5.15367,5.15367,0,0,1-2.61861.52139L17.08369,22Z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,11 @@
|
||||
<?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">
|
||||
<title>样式</title>
|
||||
<path id="形状结合" d="M21.2,19.5c0.4,0,0.8,0.3,0.8,0.8S21.7,21,21.2,21H2.8C2.3,21,2,20.7,2,20.2s0.3-0.8,0.8-0.8H21.2z
|
||||
M8.3,4.7l4,10.6h-1.4l-1-2.8H5.4l-1,2.8H3L7,4.7H8.3z M21.2,13.5c0.4,0,0.8,0.3,0.8,0.8S21.7,15,21.2,15h-5.5
|
||||
c-0.4,0-0.8-0.3-0.8-0.8s0.3-0.8,0.8-0.8H21.2z M7.7,6.4L6,11.3l3.4,0L7.7,6.4z M21.2,9C21.7,9,22,9.3,22,9.7s-0.3,0.8-0.8,0.8h-7.5
|
||||
c-0.4,0-0.8-0.3-0.8-0.8S13.3,9,13.8,9H21.2z M21.2,4.5c0.4,0,0.8,0.3,0.8,0.8S21.7,6,21.2,6h-9.5C11.3,6,11,5.7,11,5.2
|
||||
s0.3-0.8,0.8-0.8H21.2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 879 B |
@@ -0,0 +1 @@
|
||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>todo</title><path d="M18.18718,8.71967a.75.75,0,0,1,.03026,1.0286l-.03026.03206-5.94974,5.94975a1.75,1.75,0,0,1-2.43162.04182l-.04326-.04182L6.31282,12.28033a.74644.74644,0,0,1-.20333-.37421L6.095,11.80231v-.10462a.75.75,0,0,1,1.24645-.50828l.03207.03026,3.09619,3.09619a.75.75,0,0,0,1.0286.03026l.03206-.03026,5.59619-5.59619A.75.75,0,0,1,18.18718,8.71967ZM12,2.5A9.5,9.5,0,1,0,21.5,12,9.5,9.5,0,0,0,12,2.5ZM12,1A11,11,0,1,1,1,12,11,11,0,0,1,12,1Z"/></svg>
|
||||
|
After Width: | Height: | Size: 559 B |
@@ -73,7 +73,7 @@ RICH_EDITOR.getListStyle = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
console.info('insertOrderedList');
|
||||
@@ -111,7 +111,7 @@ RICH_EDITOR.setNumbers = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
child.style['list-style'] = 'decimal';
|
||||
@@ -142,7 +142,7 @@ RICH_EDITOR.setABC = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
child.style['list-style'] = 'lower-alpha';
|
||||
@@ -173,7 +173,7 @@ RICH_EDITOR.setBullets = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'UL') {
|
||||
child.style['list-style'] = 'disc';
|
||||
@@ -204,7 +204,7 @@ RICH_EDITOR.setSquare = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'UL') {
|
||||
child.style['list-style'] = 'square';
|
||||
@@ -414,7 +414,7 @@ document.body.addEventListener('paste', (event) => {
|
||||
RICH_EDITOR.getFontSizes = function () {
|
||||
document.execCommand('fontSize', false, null);
|
||||
var fontElements = window.getSelection().anchorNode.parentNode;
|
||||
var getSize = fontElements.style.fontSize;
|
||||
var getSize = parseInt(window.getComputedStyle(fontElements, null).fontSize)
|
||||
var str = callBackToApp.callbackGetSize(getSize);
|
||||
};
|
||||
|
||||
@@ -426,4 +426,74 @@ RICH_EDITOR.insertImageHtml = function (contents) {
|
||||
let img = document.createElement('img');
|
||||
img.src = contents;
|
||||
selection.getRangeAt(0).insertNode(img);
|
||||
};
|
||||
};
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
console.info(`lsq: e is ${JSON.stringify(e)}`)
|
||||
var parent = document.getElementById('editorjs');
|
||||
if (parent.id !== 'editorjs') {
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
|
||||
document.getElementById('addToDo').addEventListener('click', () => {
|
||||
callBackToApp.addToDo()
|
||||
})
|
||||
|
||||
document.getElementById('chooseStyle').addEventListener('click', () => {
|
||||
callBackToApp.chooseStyle()
|
||||
})
|
||||
|
||||
document.getElementById('openAlbum').addEventListener('click', () => {
|
||||
callBackToApp.openAlbum()
|
||||
})
|
||||
|
||||
function changeSizeToRk() {
|
||||
document.getElementById('img1').style.width = '40px';
|
||||
document.getElementById('img1').style.height = '40px';
|
||||
document.getElementById('img2').style.width = '40px';
|
||||
document.getElementById('img2').style.height = '40px';
|
||||
document.getElementById('img3').style.width = '40px';
|
||||
document.getElementById('img3').style.height = '40px';
|
||||
document.getElementById('lable1').style.fontSize = '20px';
|
||||
document.getElementById('lable2').style.fontSize = '20px';
|
||||
document.getElementById('lable3').style.fontSize = '20px';
|
||||
}
|
||||
|
||||
function changeSizeToPhone() {
|
||||
document.getElementById('img1').style.width = '24px';
|
||||
document.getElementById('img1').style.height = '24px';
|
||||
document.getElementById('img2').style.width = '24px';
|
||||
document.getElementById('img2').style.height = '24px';
|
||||
document.getElementById('img3').style.width = '24px';
|
||||
document.getElementById('img3').style.height = '24px';
|
||||
document.getElementById('lable1').style.fontSize = '12px';
|
||||
document.getElementById('lable2').style.fontSize = '12px';
|
||||
document.getElementById('lable3').style.fontSize = '12px';
|
||||
}
|
||||
|
||||
function changeSizeToTablet() {
|
||||
document.getElementById('img1').style.width = '28px';
|
||||
document.getElementById('img1').style.height = '28px';
|
||||
document.getElementById('img2').style.width = '28px';
|
||||
document.getElementById('img2').style.height = '28px';
|
||||
document.getElementById('img3').style.width = '28px';
|
||||
document.getElementById('img3').style.height = '28px';
|
||||
document.getElementById('lable1').style.fontSize = '12px';
|
||||
document.getElementById('lable2').style.fontSize = '12px';
|
||||
document.getElementById('lable3').style.fontSize = '12px';
|
||||
}
|
||||
|
||||
function hiddenButton() {
|
||||
document.getElementById('buttonBox').style.display = 'none';
|
||||
}
|
||||
|
||||
RICH_EDITOR.getFocus = function() {
|
||||
return document.getElementById('editorjs').focus();
|
||||
}
|
||||
|
||||
document.getElementById('editorjs').addEventListener('click', () => {
|
||||
if (callBackToApp.getBreakPoint() === 'sm') {
|
||||
document.getElementById('buttonBox').style.display = 'flex';
|
||||
}
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
/build
|
||||
/package.json
|
||||
+13
-13
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export class NoteUtil {
|
||||
setNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) {
|
||||
LogUtil.info(TAG, "setNoteChecked")
|
||||
checkedNoteArray.push(noteItem)
|
||||
AppStorage.Set('CheckedNoteArray',checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,6 +53,7 @@ export class NoteUtil {
|
||||
})
|
||||
LogUtil.info(TAG, "index " + index.toString() + noteItem.uuid)
|
||||
index == -1 ? null : checkedNoteArray.splice(index, 1)
|
||||
AppStorage.Set('CheckedNoteArray',checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +84,7 @@ export class NoteUtil {
|
||||
LogUtil.info(TAG, "setAllNotesChecked")
|
||||
this.unsetAllNotesChecked(checkedNoteArray)
|
||||
checkedNoteArray.push(...noteArray)
|
||||
AppStorage.Set('CheckedNoteArray', checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,6 +95,7 @@ export class NoteUtil {
|
||||
unsetAllNotesChecked(checkedNoteArray: NoteData[]) {
|
||||
LogUtil.info(TAG, "unsetAllNotesChecked")
|
||||
checkedNoteArray.splice(0, checkedNoteArray.length)
|
||||
AppStorage.Set('CheckedNoteArray', checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,6 +184,10 @@ export class NoteUtil {
|
||||
for (let index = 0; index < allNoteDataArray.length; ) {
|
||||
if (allNoteDataArray[index].is_deleted == Delete.Yes && new Date().getTime() - allNoteDataArray[index].deleted_time > StyleConstants.DELETE_DEADLINE) {
|
||||
LogUtil.info(TAG, "Delete Note, uuid " + allNoteDataArray[index].uuid + " delete time " + allNoteDataArray[index].deleted_time)
|
||||
// delete note from db
|
||||
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
|
||||
predicates_note.equalTo(NoteTableColumn.Uuid, allNoteDataArray[index].uuid)
|
||||
RdbStoreUtil.delete(predicates_note, null)
|
||||
allNoteDataArray.splice(index, 1);
|
||||
}
|
||||
index++
|
||||
@@ -272,6 +280,11 @@ export class NoteUtil {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
refreshAll() {
|
||||
let isRefresh = AppStorage.Get('isUpdate')
|
||||
AppStorage.Set('isUpdate',!isRefresh)
|
||||
}
|
||||
}
|
||||
|
||||
let noteUtil = new NoteUtil()
|
||||
|
||||
@@ -57,6 +57,25 @@ export class OperationUtils {
|
||||
return imagePath.toString()
|
||||
}
|
||||
|
||||
saveImageData(dataArray: Uint8Array, imageType: string): string {
|
||||
try {
|
||||
var context = globalThis.noteContext
|
||||
// 1、获取本地路径
|
||||
var dir = context.filesDir
|
||||
var time = new Date().getTime()
|
||||
var imagePath = dir + "/" + time.toString() + "_note" + "." + imageType
|
||||
let fd = fileio.openSync(imagePath, 0o100 | 0o2, 0o666)
|
||||
// 3、把image数据写入本地图片文件中
|
||||
fileio.writeSync(fd, dataArray.buffer)
|
||||
} catch (error) {
|
||||
LogUtil.info(TAG, "create error: " + error);
|
||||
return;
|
||||
}
|
||||
LogUtil.info(TAG, 'save image end');
|
||||
|
||||
return imagePath.toString()
|
||||
}
|
||||
|
||||
saveImage(imageData: string, imageType: string): string {
|
||||
try {
|
||||
var context = globalThis.noteContext
|
||||
|
||||
@@ -200,8 +200,15 @@ export default {
|
||||
let title = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Title))
|
||||
let uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Uuid))
|
||||
let folder_uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.FolderUuid))
|
||||
let content_text = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentText))
|
||||
let content_img = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentImg))
|
||||
// 暂时规避备忘录二次打开白屏问题,后续数据库解决
|
||||
let content_text = '';
|
||||
let content_img = '';
|
||||
try {
|
||||
content_text = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentText))
|
||||
content_img = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentImg))
|
||||
} catch (err) {
|
||||
LogUtil.error(TAG, "initAppStorage, content_img = error : " + err)
|
||||
}
|
||||
let noteType = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.NoteType))
|
||||
let is_top = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsTop))
|
||||
let is_favorite = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsFavorite))
|
||||
|
||||
@@ -20,6 +20,7 @@ import {TableName, NoteTableColumn} from '../../model/databaseModel/EnumData'
|
||||
import NoteUtil from '../../baseUtil/NoteUtil'
|
||||
import RdbStoreUtil from '../../baseUtil/RdbStoreUtil'
|
||||
import SysDefData from '../../model/databaseModel/SysDefData'
|
||||
import util from '@ohos.util'
|
||||
|
||||
const TAG = "SearchModel"
|
||||
|
||||
@@ -42,7 +43,17 @@ export class SearchModel {
|
||||
}
|
||||
let searchData: NoteData[] = [];
|
||||
noteDataArray.forEach((noteData) => {
|
||||
if (noteData.content_text.replace(/<[^>]+>/g,"").toLowerCase().indexOf(query.toLowerCase()) != -1
|
||||
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
|
||||
let contentTextValue: string
|
||||
if (base64regex.test(noteData.content_text)) {
|
||||
let Base64 = new util.Base64()
|
||||
let textDecoder = new util.TextDecoder("utf-8", { ignoreBOM: true }) // utf-8:编码格式为utf-8,ignoreBOM:是否忽略BOM标记
|
||||
let decodeStr = Base64.decodeSync(noteData.content_text)
|
||||
contentTextValue = textDecoder.decode(decodeStr, { stream: false }) // stream:在随后的decode()调用中是否跟随附加数据块
|
||||
} else {
|
||||
contentTextValue = noteData.content_text
|
||||
}
|
||||
if (contentTextValue.replace(/<[^>]+>/g, "").toLowerCase().indexOf(query.toLowerCase()) != -1
|
||||
|| noteData.title.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
||||
LogUtil.info(TAG, "uuid " + noteData.uuid)
|
||||
searchData.push(noteData);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"name": "utils",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"uiSyntax": "ets"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
/.cxx
|
||||
/package.json
|
||||
@@ -13,13 +13,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
},
|
||||
"entryModules": [
|
||||
"phone",
|
||||
"tablet"
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
+58
-45
@@ -19,6 +19,7 @@ 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'
|
||||
import inputMethod from '@ohos.inputMethod'
|
||||
|
||||
const TAG = "CusDialogComp"
|
||||
|
||||
@@ -32,7 +33,7 @@ export struct NewOrEditFolderDialog {
|
||||
private editFolderUuid: string = ""
|
||||
private dialogType: number = 0 // 0表示新建文件夹 1表示修改文件夹
|
||||
@State isExisted: boolean = false
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@Consume('SelectedColor') selectedColor: string
|
||||
|
||||
build() {
|
||||
@@ -69,6 +70,7 @@ export struct NewOrEditFolderDialog {
|
||||
this.isExisted = result
|
||||
})
|
||||
})
|
||||
.restoreId(1)
|
||||
}.margin({ bottom: 4, left: 24, right: 24 })
|
||||
|
||||
Divider()
|
||||
@@ -97,6 +99,7 @@ export struct NewOrEditFolderDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.newOrEditFolderDialogCtl.close()
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
Divider()
|
||||
.vertical(true)
|
||||
@@ -118,7 +121,12 @@ export struct NewOrEditFolderDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.newOrEditFolderDialogCtl.close()
|
||||
this.confirm(this.selectedColor, this.inputName)
|
||||
if (this.inputName.replace(/\s+/g, '') == '') {
|
||||
return
|
||||
} else {
|
||||
this.confirm(this.selectedColor, this.inputName)
|
||||
}
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
}.width('100%')
|
||||
.margin({ top: 21, bottom: 25 })
|
||||
@@ -130,7 +138,7 @@ export struct NewOrEditFolderDialog {
|
||||
.margin({ bottom: 16, left: 12, right: 12 })
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
var currentFolder: FolderData = FolderUtil.getFolderData(this.AllFolderArray, this.editFolderUuid) // 获取当前选中的文件夹
|
||||
if (currentFolder == null) {
|
||||
return
|
||||
@@ -173,9 +181,9 @@ struct ColorCircleComp {
|
||||
|
||||
@CustomDialog
|
||||
export struct DeleteDialog {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
private multiSelect: boolean = false
|
||||
@@ -265,7 +273,7 @@ export struct DeleteDialog {
|
||||
@Component
|
||||
struct NoteDataMoveItemComp {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
private folderItem: FolderData
|
||||
dividerShow: boolean = true
|
||||
|
||||
@@ -320,7 +328,7 @@ export struct NoteDataMoveDialog {
|
||||
noteDataMoveDialogCtl: CustomDialogController
|
||||
onConfirm: (folderUuid: string) => void
|
||||
NoteDataMoveArray: FolderData[]
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
|
||||
aboutToAppear() {
|
||||
this.NoteDataMoveArray = this.AllFolderArray.slice(2, this.AllFolderArray.length);
|
||||
@@ -390,7 +398,6 @@ export struct EditContentDialog {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
private circleColor: string
|
||||
private fontSize: number
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
|
||||
aboutToAppear() {
|
||||
this.confirm("javascript:RICH_EDITOR.getFontSizes()")
|
||||
@@ -400,7 +407,7 @@ export struct EditContentDialog {
|
||||
Row() {
|
||||
Column() {
|
||||
Row({ space: 70 }) {
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.action_bold'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -412,7 +419,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_italic'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -424,7 +431,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.underline'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -436,19 +443,19 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.right_justify'))
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.left_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
this.confirm("javascript:RICH_EDITOR.setJustifyRight()")
|
||||
this.confirm("javascript:RICH_EDITOR.setJustifyLeft()")
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.mid_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -460,12 +467,12 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.left_justify'))
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.right_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
this.confirm("javascript:RICH_EDITOR.setJustifyLeft()")
|
||||
this.confirm("javascript:RICH_EDITOR.setJustifyRight()")
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
@@ -481,7 +488,7 @@ export struct EditContentDialog {
|
||||
.color($r("app.color.divider_color_e4e4e4"))
|
||||
|
||||
Row({ space: 70 }) {
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.suojin'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -493,7 +500,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.suojin_back'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -506,7 +513,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r("app.media.format_menulist_number"))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -518,7 +525,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r("app.media.format_menulist_alphabet"))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -530,7 +537,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_menubullte2'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -542,7 +549,7 @@ export struct EditContentDialog {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_menubullte1'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -578,7 +585,6 @@ export struct EditContentDialog {
|
||||
.fillColor('#99182431')
|
||||
.onClick(() => {
|
||||
this.editContentDialogCtl.close()
|
||||
this.closeEditContentDialog = true
|
||||
})
|
||||
}
|
||||
.height(36)
|
||||
@@ -655,8 +661,7 @@ export struct EditTitleDialog {
|
||||
editTitleDialog: CustomDialogController
|
||||
confirm: (newTitle: string) => void
|
||||
@State inputName: string = ""
|
||||
private isEquivalentVal: boolean= true
|
||||
|
||||
@State isEquivalentVal: boolean = true
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
@@ -676,12 +681,12 @@ export struct EditTitleDialog {
|
||||
.onChange((value: string) => {
|
||||
if (this.inputName == value) {
|
||||
this.isEquivalentVal = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.isEquivalentVal = false
|
||||
}
|
||||
this.inputName = value
|
||||
})
|
||||
.restoreId(2)
|
||||
}.margin({ bottom: 4, left: 24, right: 24 })
|
||||
|
||||
|
||||
@@ -694,6 +699,7 @@ export struct EditTitleDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.editTitleDialog.close()
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
Divider()
|
||||
.vertical(true)
|
||||
@@ -709,7 +715,12 @@ export struct EditTitleDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.editTitleDialog.close()
|
||||
this.confirm(this.inputName)
|
||||
inputMethod.getController().stopInputSession();
|
||||
if (this.inputName.replace(/\s+/g, '') == '') {
|
||||
return
|
||||
} else {
|
||||
this.confirm(this.inputName)
|
||||
}
|
||||
})
|
||||
}.width('100%')
|
||||
.margin({ top: 21, bottom: 25 })
|
||||
@@ -728,10 +739,13 @@ export struct EditContentDialogPortrait {
|
||||
confirm: (excuteJs: string) => void
|
||||
@State selectFontColor: string = fontColorArray[0]
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
private circleColor: string
|
||||
private fontSize: number
|
||||
|
||||
aboutToAppear() {
|
||||
this.confirm("javascript:RICH_EDITOR.getFontSizes()")
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
|
||||
@@ -746,7 +760,6 @@ export struct EditContentDialogPortrait {
|
||||
.fillColor($r("app.color.font_stylecolor_AD182431"))
|
||||
.onClick(() => {
|
||||
this.editContentDialogCtl.close()
|
||||
this.closeEditContentDialog = true
|
||||
})
|
||||
}
|
||||
.height(48)
|
||||
@@ -754,7 +767,7 @@ export struct EditContentDialogPortrait {
|
||||
|
||||
|
||||
Row({ space: 16 }) {
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.action_bold'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -766,7 +779,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_italic'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -778,7 +791,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.underline'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -790,7 +803,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.right_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -802,7 +815,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.mid_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -814,7 +827,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.left_justify'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -832,7 +845,7 @@ export struct EditContentDialogPortrait {
|
||||
|
||||
Row({ space: 16 }) {
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.suojin'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -844,7 +857,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.suojin_back'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -857,7 +870,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r("app.media.format_menulist_number"))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -869,7 +882,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r("app.media.format_menulist_alphabet"))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -881,7 +894,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_menubullte2'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
@@ -893,7 +906,7 @@ export struct EditContentDialogPortrait {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Image($r('app.media.format_menubullte1'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
+45
-32
@@ -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,11 +34,13 @@ 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"
|
||||
@Consume('AsideWidth') asideWidth: number
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
@@ -42,9 +51,12 @@ export struct FolderListComp {
|
||||
.width(24)
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.onClick(() => {
|
||||
if (this.sectionStatus == 1) {
|
||||
this.expandStatus = !this.expandStatus
|
||||
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
|
||||
animateTo({ duration: 200 }, () => {
|
||||
this.expandStatus = !this.expandStatus
|
||||
})
|
||||
} else {
|
||||
this.asideWidth = 0
|
||||
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
|
||||
// save continue data
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
|
||||
@@ -68,7 +80,10 @@ export struct FolderListComp {
|
||||
}
|
||||
}
|
||||
}, folderItem => folderItem.name.toString())
|
||||
}.width('100%').height(450)
|
||||
}
|
||||
.width('100%')
|
||||
.height(500)
|
||||
.margin({ bottom: 120 })
|
||||
.padding({ left: 12, right: 12 })
|
||||
.flexGrow(1)
|
||||
}
|
||||
@@ -90,20 +105,22 @@ export struct FolderListComp {
|
||||
.padding({ left: 12, right: 12, bottom: 24 })
|
||||
}
|
||||
.height("100%")
|
||||
.backgroundColor($r('app.color.folder_color_d6d6d6'))
|
||||
.backgroundBlurStyle(BlurStyle.Thick)
|
||||
}
|
||||
|
||||
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({
|
||||
@@ -124,6 +141,7 @@ export struct NoteAndCreateComp {
|
||||
this.AllFolderArray.push(folderData)
|
||||
// insert folder to db
|
||||
RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null)
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
}
|
||||
|
||||
build() {
|
||||
@@ -157,9 +175,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
|
||||
@@ -167,8 +185,9 @@ struct FolderItemComp {
|
||||
@Consume('SelectedColor') selectedColor: string
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
controllerShow: WebController
|
||||
private isLongPress: boolean = false
|
||||
@State isLongPress: boolean = false
|
||||
TAG = "FolderListComp"
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
// Folder Edit Dialog
|
||||
folderEditDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: NewOrEditFolderDialog({
|
||||
@@ -200,6 +219,7 @@ struct FolderItemComp {
|
||||
let predicates_folder = RdbStoreUtil.getRdbPredicates(TableName.FolderTable)
|
||||
predicates_folder.equalTo(FolderTableColumn.Uuid, this.folderItem.uuid)
|
||||
RdbStoreUtil.update(this.folderItem.toFolderObject(), predicates_folder, null)
|
||||
this.isUpdate = true
|
||||
}
|
||||
// Folder Delete Dialog
|
||||
folderDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -267,6 +287,7 @@ struct FolderItemComp {
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(this.TAG, "onDeleteConfirm, set continue note success")
|
||||
}
|
||||
this.isUpdate = true
|
||||
}
|
||||
// Folder Create Dialog
|
||||
folderCreateDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -288,6 +309,7 @@ struct FolderItemComp {
|
||||
this.AllFolderArray.push(folderData)
|
||||
// insert folder to db
|
||||
RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null)
|
||||
this.isUpdate = true
|
||||
}
|
||||
|
||||
@Builder menuBuilder() {
|
||||
@@ -356,12 +378,14 @@ struct FolderItemComp {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Row() {
|
||||
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
|
||||
.id(this.isUpdate + '')
|
||||
.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))
|
||||
.id(this.isUpdate + '')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize(16)
|
||||
.textAlign(TextAlign.Center)
|
||||
@@ -374,6 +398,7 @@ struct FolderItemComp {
|
||||
}.width(118)
|
||||
|
||||
Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.folderItem.uuid).toString())
|
||||
.id(this.isUpdate + '')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize(14)
|
||||
.textAlign(TextAlign.Center)
|
||||
@@ -383,7 +408,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_ffffff") : "#00FFFFFF")
|
||||
.bindContextMenu(this.menuBuilder, ResponseType.LongPress)
|
||||
.bindContextMenu(this.menuBuilder, ResponseType.RightClick)
|
||||
.onClick(() => {
|
||||
@@ -408,17 +433,20 @@ struct FolderItemComp {
|
||||
AppStorage.SetOrCreate('ContinueSection', 3)
|
||||
LogUtil.info(this.TAG, "FolderItemComp, set continue note success")
|
||||
}
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
} else {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Row() {
|
||||
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
|
||||
.id(this.isUpdate + '')
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width(24)
|
||||
.height(24)
|
||||
.fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid))
|
||||
.fillColor(this.isUpdate ? FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid) : FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid))
|
||||
.margin({ right: 16 })
|
||||
Text(FolderUtil.getFolderText(this.folderItem))
|
||||
.id(this.isUpdate + '')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize(16)
|
||||
.textAlign(TextAlign.Center)
|
||||
@@ -431,6 +459,7 @@ struct FolderItemComp {
|
||||
}.width(118)
|
||||
|
||||
Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.folderItem.uuid).toString())
|
||||
.id(this.isUpdate + '')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize(14)
|
||||
.textAlign(TextAlign.Center)
|
||||
@@ -440,7 +469,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_ffffff") : "#00FFFFFF")
|
||||
.onClick(() => {
|
||||
if (this.longpress) {
|
||||
this.longpress = false
|
||||
@@ -463,6 +492,7 @@ struct FolderItemComp {
|
||||
AppStorage.SetOrCreate('ContinueSection', 3)
|
||||
LogUtil.info(this.TAG, "FolderItemComp, set continue note success")
|
||||
}
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -482,21 +512,4 @@ struct FolderItemComp {
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
export struct FolderListBackGround {
|
||||
build() {
|
||||
Column() {
|
||||
}
|
||||
.shadow({
|
||||
radius: 54,
|
||||
offsetY: 24
|
||||
})
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.backgroundColor($r('app.color.folder_color_d6d6d6'))
|
||||
.backgroundBlurStyle(BlurStyle.Thick)
|
||||
}
|
||||
}
|
||||
+137
-51
@@ -17,8 +17,13 @@ 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 { atob, btoa } from 'js-base64'
|
||||
import { TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete
|
||||
import util from '@ohos.util'
|
||||
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'
|
||||
@@ -30,7 +35,7 @@ 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';
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
import { folderTextMap } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
|
||||
|
||||
const TAG = "NoteContent"
|
||||
@@ -39,13 +44,47 @@ var timeID: number
|
||||
|
||||
@Component
|
||||
export struct NoteContent {
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Provide('Issave') issave: number = 0
|
||||
@Provide('EditModel') editModel: boolean = false
|
||||
@StorageLink('dpi') dpi: number = 240
|
||||
controllerShow: WebController
|
||||
private editContentFlag = false
|
||||
@StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0
|
||||
|
||||
storeScrollTop(scrollTop: number) {
|
||||
if (scrollTop < 0) {
|
||||
return
|
||||
}
|
||||
AppStorage.SetOrCreate<number>('ScrollTopPercent', scrollTop / this.controllerShow.getPageHeight())
|
||||
}
|
||||
|
||||
restoreScrollTop() {
|
||||
if (!AppStorage.Has('remoteScrollTopPercent')) {
|
||||
return
|
||||
}
|
||||
var scrollTopPercent = AppStorage.Get<number>('remoteScrollTopPercent')
|
||||
if (scrollTopPercent < 0) {
|
||||
return
|
||||
}
|
||||
this.controllerShow.runJavaScript({
|
||||
script: 'document.documentElement.scrollTop = ' + this.controllerShow.getPageHeight() * scrollTopPercent
|
||||
})
|
||||
AppStorage.Delete('remoteScrollTopPercent')
|
||||
}
|
||||
|
||||
restoreFocus() {
|
||||
if (!AppStorage.Has('isRemoteFocusOnSearch')) {
|
||||
return
|
||||
}
|
||||
let isRemoteFocusOnSearch = AppStorage.Get<boolean>('isRemoteFocusOnSearch')
|
||||
if (isRemoteFocusOnSearch) {
|
||||
focusControl.requestFocus('searchInput')
|
||||
}
|
||||
AppStorage.Delete('isRemoteFocusOnSearch')
|
||||
}
|
||||
|
||||
noteContent = {
|
||||
callbackhtml: (html) => {
|
||||
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
|
||||
@@ -95,15 +134,19 @@ export struct NoteContent {
|
||||
LogUtil.info(TAG, " getSrcFromHtml, src[1] : " + html)
|
||||
let imgData = html.split(',')[1];
|
||||
let imgType = 'png'
|
||||
if (html.indexOf("jpeg") > 0){
|
||||
if (html.indexOf("jpeg") > 0) {
|
||||
imgType = 'jpg'
|
||||
} else if (html.indexOf("gif") > 0) {
|
||||
imgType = 'gif'
|
||||
}
|
||||
let filePath = ""
|
||||
if (base64regex.test(imgData)) {
|
||||
imgData = atob(imgData)
|
||||
let base64 = new util.Base64()
|
||||
let decodeArr = base64.decodeSync(imgData)
|
||||
filePath = OperationUtils.saveImageData(decodeArr, imgType)
|
||||
} else {
|
||||
filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
}
|
||||
let filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
realHtml = "file://" + filePath
|
||||
}
|
||||
LogUtil.info(TAG, 'paste info11' + realHtml)
|
||||
@@ -111,6 +154,19 @@ export struct NoteContent {
|
||||
} else {
|
||||
LogUtil.info(TAG, 'paste info22223')
|
||||
}
|
||||
},
|
||||
callbackGetSize: (fontSize) => {
|
||||
if (fontSize === 16) {
|
||||
this.selectedNoteData.slider_value = 0
|
||||
} else if (fontSize === 18) {
|
||||
this.selectedNoteData.slider_value = 4
|
||||
} else if (fontSize === 24) {
|
||||
this.selectedNoteData.slider_value = 8
|
||||
} else if (fontSize === 32) {
|
||||
this.selectedNoteData.slider_value = 12
|
||||
} else if (fontSize === 48) {
|
||||
this.selectedNoteData.slider_value = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,14 +186,32 @@ export struct NoteContent {
|
||||
.javaScriptProxy({
|
||||
object: this.noteContent,
|
||||
name: "callBackToApp", // html--> name.method
|
||||
methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath"],
|
||||
controller:this.controllerShow
|
||||
methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath", "callbackGetSize"],
|
||||
controller: this.controllerShow
|
||||
})
|
||||
.onPageEnd((e) => {
|
||||
if (this.dpi <= 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToRk()" })
|
||||
} else if (this.dpi <= 320 && this.dpi > 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" })
|
||||
} else {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" })
|
||||
}
|
||||
if (AppStorage.Get('breakPoint') !== 'sm') {
|
||||
this.controllerShow.runJavaScript({ script: "hiddenButton()" })
|
||||
}
|
||||
LogUtil.info(TAG, "finish loadurl")
|
||||
if (this.selectedNoteData) {
|
||||
let self = this
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')",
|
||||
callback: () => {
|
||||
// wait for the image in the note to load
|
||||
setTimeout(function () {
|
||||
self.restoreScrollTop()
|
||||
self.restoreFocus()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -148,23 +222,24 @@ export struct NoteContent {
|
||||
.domStorageAccess(true)
|
||||
.height('70%')
|
||||
.width('100%')
|
||||
.onScroll((event) => {
|
||||
this.storeScrollTop(event.yOffset)
|
||||
})
|
||||
.onClick(() => {
|
||||
// 添加定时器:3s自动保存
|
||||
if (timeID) {
|
||||
clearInterval(timeID)
|
||||
}
|
||||
timeID = setInterval(() => {
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeID : " + timeID)
|
||||
this.issave = 0
|
||||
this.editModel = true
|
||||
})
|
||||
}
|
||||
.margin({ left: 12, right: 24, top: 16 })
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.onClick(() => {
|
||||
// 添加定时器:3s自动保存
|
||||
if (timeID) {
|
||||
clearInterval(timeID)
|
||||
}
|
||||
timeID = setInterval(() => {
|
||||
if(this.closeEditContentDialog){
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeID : " + timeID)
|
||||
this.issave = 0
|
||||
this.editModel = true
|
||||
})
|
||||
}
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
@@ -172,11 +247,13 @@ export struct NoteContent {
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info(TAG, "aboutToAppear")
|
||||
}
|
||||
|
||||
aboutToDisappear(): void{
|
||||
aboutToDisappear(): void {
|
||||
AppStorage.Set("refreshCurrentNote", true)
|
||||
NoteUtil.refreshAll()
|
||||
clearInterval(timeID)
|
||||
LogUtil.info(TAG, "aboutToDisappear")
|
||||
}
|
||||
@@ -184,9 +261,8 @@ export struct NoteContent {
|
||||
|
||||
@Component
|
||||
export struct ToolBarComp {
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Consume('Issave') issave: number
|
||||
@Consume('EditModel') editModel: boolean
|
||||
controllerShow: WebController
|
||||
@@ -195,13 +271,8 @@ export struct ToolBarComp {
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.existApp
|
||||
})
|
||||
|
||||
existApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
@@ -220,7 +291,9 @@ export struct ToolBarComp {
|
||||
LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID)
|
||||
clearInterval(timeID)
|
||||
}
|
||||
AppStorage.Set("refreshCurrentNote", true)
|
||||
router.back()
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
|
||||
@@ -238,6 +311,7 @@ export struct ToolBarComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, 'ToolBarComp, set continue note success')
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}.width(36)
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
@@ -249,14 +323,15 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
// 清单
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.font_style'))
|
||||
@@ -264,21 +339,22 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
LogUtil.info(TAG, 'editContentDialogCtl start')
|
||||
this.closeEditContentDialog = false
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.picture_white')).height(24).width(24)
|
||||
.onClick(async () => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
LogUtil.info(TAG, 'startAbility start')
|
||||
await globalThis.noteContext.startAbilityForResult({
|
||||
parameters: { uri: "singleselect" },
|
||||
@@ -302,6 +378,9 @@ export struct ToolBarComp {
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "javascript:RICH_EDITOR.insertImage('" + path + "')"
|
||||
})
|
||||
this.issave = 1
|
||||
// 保存笔记信息到数据库
|
||||
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -310,8 +389,7 @@ export struct ToolBarComp {
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.undo'))
|
||||
@@ -319,13 +397,14 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" })
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.todo'))
|
||||
@@ -333,13 +412,14 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" })
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
@@ -355,7 +435,7 @@ export struct ToolBarComp {
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
}.width(274)
|
||||
}
|
||||
}
|
||||
@@ -367,8 +447,9 @@ export struct ToolBarComp {
|
||||
@Component
|
||||
export struct NoteContentOverViewComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: EditTitleDialog({ confirm: this.confirm.bind(this) }),
|
||||
alignment: DialogAlignment.Center,
|
||||
@@ -386,6 +467,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "NoteContentOverViewComp confirm, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@@ -404,8 +486,9 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "NoteContentOverViewComp MenuBuilder, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}, noteItem => noteItem.uuid)
|
||||
}, noteItem => JSON.stringify(noteItem))
|
||||
}.listDirection(Axis.Vertical)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56)
|
||||
@@ -421,6 +504,7 @@ export struct NoteContentOverViewComp {
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(30)
|
||||
.margin({ left: 12, right: 24 })
|
||||
.onClick(() => {
|
||||
@@ -432,6 +516,7 @@ export struct NoteContentOverViewComp {
|
||||
|
||||
Row() {
|
||||
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(12)
|
||||
.padding({ top: 4, bottom: 4 })
|
||||
.fontColor($r("app.color.modified_time_font_color"))
|
||||
@@ -440,6 +525,7 @@ export struct NoteContentOverViewComp {
|
||||
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)) ==
|
||||
folderTextMap["sys_def_myFavorites_uuid"] ? folderTextMap["sys_def_unClassified_uuid"] :
|
||||
FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(12)
|
||||
.fontColor($r("app.color.list_modified_time_font_color"))
|
||||
Image($r('app.media.triangle'))
|
||||
@@ -464,7 +550,7 @@ export struct NoteContentOverViewComp {
|
||||
@Component
|
||||
struct NoteDataMoveItemComp {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
private folderItem: FolderData
|
||||
|
||||
build() {
|
||||
+168
-51
@@ -17,18 +17,23 @@ 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
|
||||
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 { atob, btoa } from 'js-base64'
|
||||
import util from '@ohos.util'
|
||||
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';
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
import { folderTextMap } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
|
||||
|
||||
const TAG = "NoteContentComp"
|
||||
@@ -41,7 +46,7 @@ let inSetValue = AppStorage.Link('inSetValue')
|
||||
@Component
|
||||
export struct NoteContentComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('RefreshFlag') refreshFlag: number
|
||||
@Consume('EditModel') editModel: boolean
|
||||
@@ -49,11 +54,55 @@ export struct NoteContentComp {
|
||||
@Consume('LastSectionStatus') lastSectionStatus: number
|
||||
@Consume('Issave') issave: number
|
||||
@Consume('Search') search: boolean
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@StorageLink('dpi') dpi: number = 240
|
||||
controllerShow: WebController
|
||||
private editContentFlag = false
|
||||
@State uri1: string = ""
|
||||
private context = getContext(this)
|
||||
@StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
@StorageLink('refreshCurrentNote') @Watch('isDataChange') refreshCurrentNote: boolean = false
|
||||
@Consume('AsideWidth') asideWidth: number
|
||||
|
||||
isDataChange() {
|
||||
if (!this.refreshCurrentNote) {
|
||||
return
|
||||
}
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" })
|
||||
this.refreshCurrentNote = false
|
||||
}
|
||||
|
||||
storeScrollTop(scrollTop: number) {
|
||||
if (scrollTop < 0) {
|
||||
return
|
||||
}
|
||||
AppStorage.SetOrCreate<number>('ScrollTopPercent', scrollTop / this.controllerShow.getPageHeight())
|
||||
}
|
||||
|
||||
restoreScrollTop() {
|
||||
if (!AppStorage.Has('remoteScrollTopPercent')) {
|
||||
return
|
||||
}
|
||||
var scrollTopPercent = AppStorage.Get<number>('remoteScrollTopPercent')
|
||||
if (scrollTopPercent < 0) {
|
||||
return
|
||||
}
|
||||
this.controllerShow.runJavaScript({
|
||||
script: 'document.documentElement.scrollTop = ' + this.controllerShow.getPageHeight() * scrollTopPercent
|
||||
})
|
||||
}
|
||||
|
||||
restoreFocus() {
|
||||
if (!AppStorage.Has('isRemoteFocusOnSearch')) {
|
||||
return
|
||||
}
|
||||
let isRemoteFocusOnSearch = AppStorage.Get<boolean>('isRemoteFocusOnSearch')
|
||||
if (isRemoteFocusOnSearch) {
|
||||
focusControl.requestFocus('searchInput')
|
||||
}
|
||||
AppStorage.Delete('isRemoteFocusOnSearch')
|
||||
}
|
||||
|
||||
noteContent = {
|
||||
callbackhtml: (html) => {
|
||||
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
|
||||
@@ -117,19 +166,23 @@ export struct NoteContentComp {
|
||||
let realHtml = ""
|
||||
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
|
||||
if (html && html.indexOf("base64") > 0) {
|
||||
LogUtil.info(TAG, " getSrcFromHtml, src[1] : " + html)
|
||||
let imgData = html.split(',')[1];
|
||||
let imgType = 'png'
|
||||
if (html.indexOf("jpeg") > 0){
|
||||
imgType = 'jpg'
|
||||
} else if (html.indexOf("gif") > 0) {
|
||||
imgType = 'gif'
|
||||
}
|
||||
if (base64regex.test(imgData)) {
|
||||
imgData = atob(imgData)
|
||||
}
|
||||
let filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
realHtml = "file://" + filePath
|
||||
LogUtil.info(TAG, " getSrcFromHtml, src[1] : " + html)
|
||||
let imgData = html.split(',')[1];
|
||||
let imgType = 'png'
|
||||
if (html.indexOf("jpeg") > 0) {
|
||||
imgType = 'jpg'
|
||||
} else if (html.indexOf("gif") > 0) {
|
||||
imgType = 'gif'
|
||||
}
|
||||
let filePath = ""
|
||||
if (base64regex.test(imgData)) {
|
||||
let base64 = new util.Base64()
|
||||
let decodeArr = base64.decodeSync(imgData)
|
||||
filePath = OperationUtils.saveImageData(decodeArr, imgType)
|
||||
} else {
|
||||
filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
}
|
||||
realHtml = "file://" + filePath
|
||||
}
|
||||
LogUtil.info(TAG, 'paste info11-' + realHtml)
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.insertImageHtml('" + realHtml + "')" })
|
||||
@@ -138,10 +191,17 @@ export struct NoteContentComp {
|
||||
LogUtil.info(TAG, 'paste info22225')
|
||||
}
|
||||
},
|
||||
|
||||
callbackGetSize: (size) => {
|
||||
if (size) {
|
||||
AppStorage.Set<number>('inSetValue', parseInt(size.slice(0, -2)) - 12)
|
||||
callbackGetSize: (fontSize) => {
|
||||
if (fontSize === 16) {
|
||||
this.selectedNoteData.slider_value = 0
|
||||
} else if (fontSize === 18) {
|
||||
this.selectedNoteData.slider_value = 4
|
||||
} else if (fontSize === 24) {
|
||||
this.selectedNoteData.slider_value = 8
|
||||
} else if (fontSize === 32) {
|
||||
this.selectedNoteData.slider_value = 12
|
||||
} else if (fontSize === 48) {
|
||||
this.selectedNoteData.slider_value = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,13 +226,31 @@ export struct NoteContentComp {
|
||||
object: this.noteContent,
|
||||
name: "callBackToApp", // html--> name.method
|
||||
methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave", "callbackGetSize", "callbackPasteImage", "callbackImagePath"],
|
||||
controller:this.controllerShow
|
||||
controller: this.controllerShow
|
||||
})
|
||||
.onPageEnd((e) => {
|
||||
if (this.dpi <= 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToRk()" })
|
||||
} else if (this.dpi <= 320 && this.dpi > 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" })
|
||||
} else {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" })
|
||||
}
|
||||
if (AppStorage.Get('breakPoint') !== 'sm') {
|
||||
this.controllerShow.runJavaScript({ script: "hiddenButton()" })
|
||||
}
|
||||
LogUtil.info(TAG, "finish loadurl")
|
||||
if(this.selectedNoteData){
|
||||
if (this.selectedNoteData) {
|
||||
let self = this
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')",
|
||||
callback: () => {
|
||||
// wait for the image in the note to load
|
||||
setTimeout(function () {
|
||||
self.restoreScrollTop()
|
||||
self.restoreFocus()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
// 初次加载为为小屏预览模式
|
||||
@@ -187,9 +265,12 @@ export struct NoteContentComp {
|
||||
.zoomAccess(false)
|
||||
.height('88%')
|
||||
.width('100%')
|
||||
.onScroll((event) => {
|
||||
this.storeScrollTop(event.yOffset)
|
||||
})
|
||||
}
|
||||
.margin({ left: 24, right: 24 })
|
||||
// .width(StyleConstants.PERCENTAGE_100)
|
||||
// .width(StyleConstants.PERCENTAGE_100)
|
||||
.enabled(this.selectedNoteData && this.selectedNoteData.is_deleted == Delete.Yes ? false : true)
|
||||
.onClick(() => {
|
||||
this.issave = 0
|
||||
@@ -198,6 +279,7 @@ export struct NoteContentComp {
|
||||
LogUtil.info(TAG, "isContinue : " + isContinue)
|
||||
// 点击第三屏进入全屏编辑模式
|
||||
if (this.sectionStatus != 1 || isContinue) {
|
||||
this.asideWidth = 0
|
||||
this.lastSectionStatus = this.sectionStatus
|
||||
this.sectionStatus = 1
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
|
||||
@@ -206,9 +288,7 @@ export struct NoteContentComp {
|
||||
clearInterval(timeId)
|
||||
}
|
||||
timeId = setInterval(() => {
|
||||
if(this.closeEditContentDialog){
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeId : " + timeId)
|
||||
// save continue data
|
||||
@@ -219,6 +299,7 @@ export struct NoteContentComp {
|
||||
}
|
||||
})
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible)
|
||||
|
||||
@@ -234,11 +315,11 @@ export struct NoteContentComp {
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info(TAG, "aboutToAppear")
|
||||
}
|
||||
|
||||
aboutToDisappear(): void{
|
||||
aboutToDisappear(): void {
|
||||
clearInterval(timeId)
|
||||
LogUtil.info(TAG, "aboutToDisappear")
|
||||
}
|
||||
@@ -247,13 +328,14 @@ export struct NoteContentComp {
|
||||
@Component
|
||||
export struct NoteContentOverViewComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllFolderArray') @Watch('getArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllFolderArray') @Watch('getArray') 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
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
NoteDataMoveArray: FolderData[]
|
||||
controllerShow: WebController
|
||||
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -279,6 +361,7 @@ export struct NoteContentOverViewComp {
|
||||
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
|
||||
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
|
||||
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@@ -306,6 +389,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "NoteContentOverViewComp, MenuBuilder, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}, noteItem => noteItem.uuid)
|
||||
}.listDirection(Axis.Vertical)
|
||||
@@ -323,6 +407,7 @@ export struct NoteContentOverViewComp {
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(30)
|
||||
.margin({ left: 0, right: 24 })
|
||||
.onClick(() => {
|
||||
@@ -339,6 +424,7 @@ export struct NoteContentOverViewComp {
|
||||
|
||||
Row() {
|
||||
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(12)
|
||||
.padding({ top: 4, bottom: 4 })
|
||||
.fontColor($r("app.color.modified_time_font_color"))
|
||||
@@ -347,6 +433,7 @@ export struct NoteContentOverViewComp {
|
||||
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)) ==
|
||||
folderTextMap["sys_def_myFavorites_uuid"] ? folderTextMap["sys_def_unClassified_uuid"] :
|
||||
FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(12)
|
||||
.fontColor($r("app.color.list_modified_time_font_color"))
|
||||
.padding({ top: 1 })
|
||||
@@ -355,6 +442,7 @@ export struct NoteContentOverViewComp {
|
||||
.height(12)
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
|
||||
.margin({ left: 8 })
|
||||
.borderRadius(16)
|
||||
@@ -378,18 +466,18 @@ export struct ToolBarComp {
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('ChooseNote') chooseNote: boolean
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Consume('EditModel') editModel: boolean
|
||||
@Consume('Issave') issave: number
|
||||
controllerShow: WebController
|
||||
private context = getContext(this)
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }),
|
||||
alignment: DialogAlignment.Center,
|
||||
autoCancel: false,
|
||||
customStyle: true,
|
||||
})
|
||||
@Consume('AsideWidth') asideWidth: number
|
||||
|
||||
onDeleteConfirm() {
|
||||
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
|
||||
@@ -414,6 +502,7 @@ export struct ToolBarComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "NoteContentOverViewComp, set continue note success")
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
}
|
||||
|
||||
editContentDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -421,13 +510,8 @@ export struct ToolBarComp {
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.exisApp
|
||||
})
|
||||
|
||||
exisApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
@@ -442,9 +526,11 @@ export struct ToolBarComp {
|
||||
if (this.sectionStatus != 1) {
|
||||
this.lastSectionStatus = this.sectionStatus
|
||||
this.sectionStatus = 1
|
||||
this.asideWidth = 0
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" })
|
||||
} else {
|
||||
if (this.lastSectionStatus != undefined) {
|
||||
this.asideWidth = 200
|
||||
// 切换为小屏预览模式
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" })
|
||||
this.sectionStatus = this.lastSectionStatus
|
||||
@@ -452,7 +538,8 @@ export struct ToolBarComp {
|
||||
LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid)
|
||||
this.controllerShow.runJavaScript({ script: "saveHtmlContent()" })
|
||||
//退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
// 清除定时器
|
||||
if (timeId != undefined) {
|
||||
LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId)
|
||||
@@ -466,6 +553,7 @@ export struct ToolBarComp {
|
||||
// save continue data
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
|
||||
LogUtil.info(TAG, "ToolBarComp, set continue section success")
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
.visibility(!this.selectedNoteData ? Visibility.None : this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
|
||||
@@ -487,7 +575,7 @@ export struct ToolBarComp {
|
||||
let context: any = getContext(this)
|
||||
let resource = {
|
||||
bundleName: "com.ohos.note",
|
||||
moduleName: "tablet",
|
||||
moduleName: "default",
|
||||
id: $r('app.string.restore').id
|
||||
};
|
||||
context.resourceManager.getString(resource, (error, value) => {
|
||||
@@ -512,6 +600,7 @@ export struct ToolBarComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "recover, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}.width(72)
|
||||
} else if (this.editModel == true) {
|
||||
@@ -524,7 +613,8 @@ export struct ToolBarComp {
|
||||
// 清单
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
@@ -537,8 +627,8 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
this.closeEditContentDialog = false
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
}.width(42)
|
||||
@@ -551,8 +641,25 @@ export struct ToolBarComp {
|
||||
.height(24)
|
||||
.width(24)
|
||||
.onClick(async () => {
|
||||
let permissionList: Array<string> = [
|
||||
"ohos.permission.READ_MEDIA",
|
||||
"ohos.permission.WRITE_MEDIA",
|
||||
]
|
||||
let context: any = getContext(this);
|
||||
await context.requestPermissionsFromUser(permissionList).then((data) => {
|
||||
LogUtil.info(TAG, 'data permissions : ' + data.permissions)
|
||||
LogUtil.info(TAG, 'data result: ' + data.authResults)
|
||||
let sum = 0
|
||||
for (let i = 0; i < data.authResults.length; i++) {
|
||||
sum += data.authResults[i]
|
||||
}
|
||||
LogUtil.info(TAG, 'request permissions sum: ' + sum)
|
||||
}).catch((err) => {
|
||||
LogUtil.warn(TAG, 'failed to requestPermissionsFromUser : ' + err.code);
|
||||
})
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
LogUtil.info(TAG, 'startAbility start')
|
||||
await globalThis.noteContext.startAbilityForResult({
|
||||
parameters: { uri: "singleselect" },
|
||||
@@ -576,9 +683,13 @@ export struct ToolBarComp {
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "javascript:RICH_EDITOR.insertImage('" + path + "')"
|
||||
})
|
||||
this.issave = 1
|
||||
// 保存笔记信息到数据库
|
||||
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
|
||||
})
|
||||
}
|
||||
}
|
||||
NoteUtil.refreshAll()
|
||||
});
|
||||
})
|
||||
}.width(42)
|
||||
@@ -586,14 +697,14 @@ export struct ToolBarComp {
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.undo'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" })
|
||||
})
|
||||
}.width(42)
|
||||
@@ -607,7 +718,8 @@ export struct ToolBarComp {
|
||||
.width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" })
|
||||
})
|
||||
}.width(42)
|
||||
@@ -656,6 +768,7 @@ export struct ToolBarComp {
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "ToolBarComp, set continue note success")
|
||||
}
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Image($r('app.media.delete'))
|
||||
.height(24)
|
||||
@@ -675,7 +788,8 @@ export struct ToolBarComp {
|
||||
@Component
|
||||
struct NoteDataMoveItemCompTablet {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
folderItem: FolderData
|
||||
uuid: String
|
||||
|
||||
@@ -683,6 +797,7 @@ struct NoteDataMoveItemCompTablet {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
|
||||
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
|
||||
.id(this.isUpdate + '')
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width(24)
|
||||
.height(24)
|
||||
@@ -694,6 +809,7 @@ struct NoteDataMoveItemCompTablet {
|
||||
Column() {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Text(FolderUtil.getFolderText(this.folderItem))
|
||||
.id(this.isUpdate + '')
|
||||
.padding({ top: 3 })
|
||||
.fontSize(16)
|
||||
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid == this.uuid ? this.folderItem.uuid : '', this.folderItem.uuid == this.uuid))
|
||||
@@ -713,6 +829,7 @@ struct NoteDataMoveItemCompTablet {
|
||||
}
|
||||
.padding({ left: 16 })
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None)
|
||||
+195
-152
@@ -17,8 +17,13 @@ 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 { atob } from 'js-base64'
|
||||
import { TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete
|
||||
import util from '@ohos.util'
|
||||
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'
|
||||
@@ -28,7 +33,7 @@ import prompt from '@system.prompt'
|
||||
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';
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
import { folderTextMap } from '@ohos/utils/src/main/ets/default/model/NoteBaseData'
|
||||
import rs from '@ohos.resourceManager'
|
||||
|
||||
@@ -49,11 +54,54 @@ async function routePage() {
|
||||
export struct NoteContentCompPortrait {
|
||||
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote')
|
||||
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder")
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Provide('EditModel') editModel: boolean = false
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@StorageLink('dpi') dpi: number = 240
|
||||
controllerShow: WebController
|
||||
private editContentFlag = false
|
||||
@StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0
|
||||
editContentDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
})
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
|
||||
storeScrollTop(scrollTop: number) {
|
||||
if (scrollTop < 0) {
|
||||
return
|
||||
}
|
||||
AppStorage.SetOrCreate<number>('ScrollTopPercent', scrollTop / this.controllerShow.getPageHeight())
|
||||
}
|
||||
|
||||
restoreScrollTop() {
|
||||
if (!AppStorage.Has('remoteScrollTopPercent')) {
|
||||
return
|
||||
}
|
||||
var scrollTopPercent = AppStorage.Get<number>('remoteScrollTopPercent')
|
||||
if (scrollTopPercent < 0) {
|
||||
return
|
||||
}
|
||||
this.controllerShow.runJavaScript({
|
||||
script: 'document.documentElement.scrollTop = ' + this.controllerShow.getPageHeight() * scrollTopPercent
|
||||
})
|
||||
}
|
||||
|
||||
restoreFocus() {
|
||||
if (!AppStorage.Has('isRemoteFocusOnSearch')) {
|
||||
return
|
||||
}
|
||||
let isRemoteFocusOnSearch = AppStorage.Get<boolean>('isRemoteFocusOnSearch')
|
||||
if (isRemoteFocusOnSearch) {
|
||||
focusControl.requestFocus('searchInput')
|
||||
}
|
||||
AppStorage.Delete('isRemoteFocusOnSearch')
|
||||
}
|
||||
|
||||
noteContent = {
|
||||
callbackhtml: (html) => {
|
||||
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
|
||||
@@ -100,15 +148,19 @@ export struct NoteContentCompPortrait {
|
||||
LogUtil.info(TAG, " getSrcFromHtml, src[1] : " + html)
|
||||
let imgData = html.split(',')[1];
|
||||
let imgType = 'png'
|
||||
if (html.indexOf("jpeg") > 0){
|
||||
if (html.indexOf("jpeg") > 0) {
|
||||
imgType = 'jpg'
|
||||
} else if (html.indexOf("gif") > 0) {
|
||||
imgType = 'gif'
|
||||
}
|
||||
let filePath = ""
|
||||
if (base64regex.test(imgData)) {
|
||||
imgData = atob(imgData)
|
||||
let base64 = new util.Base64()
|
||||
let decodeArr = base64.decodeSync(imgData)
|
||||
filePath = OperationUtils.saveImageData(decodeArr, imgType)
|
||||
} else {
|
||||
filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
}
|
||||
let filePath = OperationUtils.saveImage(imgData, imgType)
|
||||
realHtml = "file://" + filePath
|
||||
}
|
||||
LogUtil.info(TAG, 'paste info11' + realHtml)
|
||||
@@ -116,6 +168,73 @@ export struct NoteContentCompPortrait {
|
||||
} else {
|
||||
LogUtil.info(TAG, 'paste info22224')
|
||||
}
|
||||
},
|
||||
callbackGetSize: (fontSize) => {
|
||||
if (fontSize === 16) {
|
||||
this.selectedNoteData.slider_value = 0
|
||||
} else if (fontSize === 18) {
|
||||
this.selectedNoteData.slider_value = 4
|
||||
} else if (fontSize === 24) {
|
||||
this.selectedNoteData.slider_value = 8
|
||||
} else if (fontSize === 32) {
|
||||
this.selectedNoteData.slider_value = 12
|
||||
} else if (fontSize === 48) {
|
||||
this.selectedNoteData.slider_value = 16
|
||||
}
|
||||
},
|
||||
addToDo: () => {
|
||||
// 清单
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" })
|
||||
},
|
||||
chooseStyle: () => {
|
||||
this.editContentDialogCtl.open()
|
||||
},
|
||||
openAlbum: async () => {
|
||||
let permissionList: Array<string> = [
|
||||
"ohos.permission.READ_MEDIA",
|
||||
"ohos.permission.WRITE_MEDIA",
|
||||
]
|
||||
let context: any = getContext(this);
|
||||
await context.requestPermissionsFromUser(permissionList).then((data) => {
|
||||
LogUtil.info(TAG, 'data permissions : ' + data.permissions)
|
||||
LogUtil.info(TAG, 'data result: ' + data.authResults)
|
||||
let sum = 0
|
||||
for (let i = 0; i < data.authResults.length; i++) {
|
||||
sum += data.authResults[i]
|
||||
}
|
||||
LogUtil.info(TAG, 'request permissions sum: ' + sum)
|
||||
}).catch((err) => {
|
||||
LogUtil.warn(TAG, 'failed to requestPermissionsFromUser : ' + err.code);
|
||||
})
|
||||
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.getFocus()" })
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.insertImage('" + path + "')" })
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getBreakPoint: () => {
|
||||
return AppStorage.Get('breakPoint');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,13 +253,28 @@ export struct NoteContentCompPortrait {
|
||||
.javaScriptProxy({
|
||||
object: this.noteContent,
|
||||
name: "callBackToApp", // html--> name.method
|
||||
methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath"],
|
||||
controller:this.controllerShow
|
||||
methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath", "addToDo", "chooseStyle", "openAlbum", "callbackGetSize", "getBreakPoint"],
|
||||
controller: this.controllerShow
|
||||
})
|
||||
.onPageEnd((e) => {
|
||||
if (this.dpi <= 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToRk()" })
|
||||
} else if (this.dpi <= 320 && this.dpi > 240) {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" })
|
||||
} else {
|
||||
this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" })
|
||||
}
|
||||
LogUtil.info(TAG, "finish loadurl")
|
||||
let self = this
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')",
|
||||
callback: () => {
|
||||
// wait for the image in the note to load
|
||||
setTimeout(function () {
|
||||
self.restoreScrollTop()
|
||||
self.restoreFocus()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
})
|
||||
.imageAccess(true)
|
||||
@@ -150,6 +284,9 @@ export struct NoteContentCompPortrait {
|
||||
.zoomAccess(false)
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
.onScroll((event) => {
|
||||
this.storeScrollTop(event.yOffset)
|
||||
})
|
||||
}
|
||||
.flexShrink(1)
|
||||
.onClick(() => {
|
||||
@@ -158,9 +295,7 @@ export struct NoteContentCompPortrait {
|
||||
}
|
||||
// 添加定时器:3s自动保存
|
||||
time_id = setInterval(() => {
|
||||
if(this.closeEditContentDialog){
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval time_id : " + time_id)
|
||||
this.editModel = true
|
||||
@@ -169,21 +304,21 @@ export struct NoteContentCompPortrait {
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
.flexShrink(1)
|
||||
.margin({ left: 24, right: 24 })
|
||||
.padding({ left: 24, right: 24 })
|
||||
|
||||
EditNoteCompForPortrait({ controllerShow: this.controllerShow })
|
||||
DeleteNoteComp()
|
||||
}
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info(TAG, "aboutToAppear")
|
||||
}
|
||||
|
||||
aboutToDisappear(): void{
|
||||
aboutToDisappear(): void {
|
||||
clearInterval(time_id)
|
||||
NoteUtil.refreshAll()
|
||||
LogUtil.info(TAG, "aboutToDisappear")
|
||||
}
|
||||
}
|
||||
@@ -191,8 +326,9 @@ export struct NoteContentCompPortrait {
|
||||
@Component
|
||||
export struct NoteContentOverViewComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
NoteDataMoveArray: FolderData[]
|
||||
editTitleDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: EditTitleDialog({ confirm: this.confirm.bind(this) }),
|
||||
@@ -216,6 +352,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, 'NoteContentOverViewComp, MenuBuilder, set continue note success')
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@@ -235,6 +372,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, 'MenuBuilder, set continue note success')
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}, noteItem => noteItem.uuid)
|
||||
}
|
||||
@@ -254,7 +392,9 @@ export struct NoteContentOverViewComp {
|
||||
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title).fontSize(30).fontWeight(FontWeight.Medium)
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(30).fontWeight(FontWeight.Medium)
|
||||
.onClick(() => {
|
||||
clearInterval(time_id)
|
||||
this.editTitleDialogCtl.open()
|
||||
@@ -264,6 +404,7 @@ export struct NoteContentOverViewComp {
|
||||
|
||||
Row() {
|
||||
Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(12)
|
||||
.padding({ top: 4, bottom: 4 })
|
||||
.fontColor($r("app.color.modified_time_font_color"))
|
||||
@@ -271,6 +412,7 @@ export struct NoteContentOverViewComp {
|
||||
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)) ==
|
||||
folderTextMap["sys_def_myFavorites_uuid"] ? folderTextMap["sys_def_unClassified_uuid"] :
|
||||
FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
|
||||
.id(this.isUpdate + '')
|
||||
.fontColor($r('app.color.folder_color_99182431'))
|
||||
.fontSize(12)
|
||||
Image($r('app.media.triangle'))
|
||||
@@ -278,6 +420,7 @@ export struct NoteContentOverViewComp {
|
||||
.height(12)
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
|
||||
.margin({ left: 8 })
|
||||
.borderRadius(16)
|
||||
@@ -297,7 +440,7 @@ export struct ToolBarComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('EditModel') editModel: boolean
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
controllerShow: WebController
|
||||
|
||||
onDeleteConfirm() {
|
||||
@@ -317,6 +460,7 @@ export struct ToolBarComp {
|
||||
RdbStoreUtil.delete(predicates_note, null)
|
||||
routePage()
|
||||
}
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
}
|
||||
|
||||
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -333,7 +477,7 @@ export struct ToolBarComp {
|
||||
Image($r('app.media.back'))
|
||||
.height(24)
|
||||
.width(24)
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.responseRegion({ width: 54, height: 54 })
|
||||
.onClick(() => {
|
||||
this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
|
||||
// 清除定时器
|
||||
@@ -342,6 +486,7 @@ export struct ToolBarComp {
|
||||
clearInterval(time_id)
|
||||
}
|
||||
router.back()
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
|
||||
if (this.editModel == false) {
|
||||
@@ -356,11 +501,15 @@ export struct ToolBarComp {
|
||||
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
|
||||
if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) {
|
||||
this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)
|
||||
this.controllerShow.runJavaScript({
|
||||
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
|
||||
})
|
||||
// save continue data
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
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')
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Image($r('app.media.delete')).height(24).width(24)
|
||||
.onClick(() => {
|
||||
@@ -374,25 +523,27 @@ export struct ToolBarComp {
|
||||
Image($r('app.media.undo')).height(24).width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.undo()" })
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.todo')).height(24).width(24)
|
||||
.onClick(() => {
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" })
|
||||
})
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
|
||||
Button({ type: ButtonType.Normal, stateEffect: true }) {
|
||||
Image($r('app.media.tick_thin')).height(24).width(24)
|
||||
@@ -404,7 +555,7 @@ export struct ToolBarComp {
|
||||
}.width(42)
|
||||
.height(42)
|
||||
.borderRadius(8)
|
||||
.backgroundColor($r('app.color.color_ffffff'))
|
||||
.backgroundColor($r('app.color.color_fffffB'))
|
||||
}
|
||||
.width(130)
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
@@ -417,8 +568,8 @@ export struct ToolBarComp {
|
||||
|
||||
@Component
|
||||
export struct DeleteNoteComp {
|
||||
@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;
|
||||
@@ -444,8 +595,10 @@ export struct DeleteNoteComp {
|
||||
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
|
||||
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
|
||||
RdbStoreUtil.delete(predicates_note, null)
|
||||
NoteUtil.refreshAll()
|
||||
routePage()
|
||||
}
|
||||
AppStorage.SetOrCreate('isUpdate', false)
|
||||
}
|
||||
|
||||
build() {
|
||||
@@ -479,7 +632,7 @@ export struct DeleteNoteComp {
|
||||
let context: any = getContext(this)
|
||||
let resource = {
|
||||
bundleName: "com.ohos.note",
|
||||
moduleName: "tablet",
|
||||
moduleName: "default",
|
||||
id: $r('app.string.restore').id
|
||||
};
|
||||
context.resourceManager.getString(resource, (error, value) => {
|
||||
@@ -494,6 +647,7 @@ export struct DeleteNoteComp {
|
||||
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
|
||||
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
|
||||
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.recover"))
|
||||
.fontSize(10)
|
||||
@@ -508,129 +662,15 @@ export struct DeleteNoteComp {
|
||||
.width(360)
|
||||
.height(56)
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ?
|
||||
Visibility.Visible : Visibility.None)
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct EditNoteCompForPortrait {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData;
|
||||
@Consume('EditModel') editModel: boolean
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
controllerShow: WebController
|
||||
editContentDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.exissApp
|
||||
})
|
||||
|
||||
exissApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
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()" })
|
||||
})
|
||||
Text($r("app.string.list"))
|
||||
.fontSize(10)
|
||||
.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.closeEditContentDialog = false
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
Text($r("app.string.style"))
|
||||
.fontSize(10)
|
||||
.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)
|
||||
.height(56)
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.No && this.editModel == true ?
|
||||
Visibility.Visible : Visibility.None)
|
||||
Visibility.Visible : Visibility.None)
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct NoteDataMoveItemCompMenu {
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
folderItem: FolderData
|
||||
uuid: String
|
||||
|
||||
@@ -638,6 +678,7 @@ struct NoteDataMoveItemCompMenu {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) {
|
||||
Image(FolderUtil.getFolderIcon(this.folderItem.uuid))
|
||||
.id(this.isUpdate + '')
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width(24)
|
||||
.height(24)
|
||||
@@ -649,6 +690,7 @@ struct NoteDataMoveItemCompMenu {
|
||||
Column() {
|
||||
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Text(FolderUtil.getFolderText(this.folderItem))
|
||||
.id(this.isUpdate + '')
|
||||
.fontSize(16)
|
||||
.fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid == this.uuid ? this.folderItem.uuid : '', this.folderItem.uuid == this.uuid))
|
||||
.textAlign(TextAlign.Center)
|
||||
@@ -668,6 +710,7 @@ struct NoteDataMoveItemCompMenu {
|
||||
}
|
||||
.padding({ left: 16 })
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None)
|
||||
+210
-100
@@ -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'
|
||||
@@ -28,6 +35,7 @@ import SearchModel from '@ohos/utils/src/main/ets/default/model/searchModel/Sear
|
||||
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
|
||||
import router from '@system.router';
|
||||
import rs from '@ohos.resourceManager'
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
|
||||
const TAG = "NoteListComp"
|
||||
|
||||
@@ -45,14 +53,14 @@ 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
|
||||
@Consume('AsideWidth') asideWidth: number
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
NoteOverViewComp({ controllerShow: this.controllerShow })
|
||||
Column() {
|
||||
@@ -73,19 +81,21 @@ export struct NoteListComp {
|
||||
.width('100%')
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
AppStorage.SetOrCreate('isUpdate', false)
|
||||
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
|
||||
@@ -94,21 +104,32 @@ struct NoteOverViewComp {
|
||||
@Consume('Search') search: boolean
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
controllerShow: WebController
|
||||
@State noteNumber: any = undefined
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
@Consume('AsideWidth') asideWidth: number
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
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) {
|
||||
this.expandStatus = !this.expandStatus
|
||||
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
|
||||
animateTo({ duration: 200 }, () => {
|
||||
this.expandStatus = !this.expandStatus
|
||||
})
|
||||
} else {
|
||||
this.asideWidth = 200
|
||||
this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
|
||||
// save continue data
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
|
||||
@@ -124,42 +145,51 @@ struct NoteOverViewComp {
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Text(FolderUtil.getFolderText(this.selectedFolderData))
|
||||
.fontSize(this.portraitModel ? 30 : '15lpx')
|
||||
.id(this.isUpdate + '')
|
||||
.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')
|
||||
.id(this.isUpdate + '')
|
||||
.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 +197,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,14 +213,27 @@ export struct NoteItemComp {
|
||||
controllerShow: WebController
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@Consume('Longpress') longpress: boolean
|
||||
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray')
|
||||
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
|
||||
@Consume('ChooseNote') chooseNote: boolean
|
||||
@Consume('RefreshFlag') refreshFlag: number
|
||||
@Consume('Search') search: boolean
|
||||
@Consume('selectedAll') selectedAll: boolean
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@State isChecked: boolean = undefined
|
||||
@Consume('Longpress') @Watch('isLongPress') longpress: boolean
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
|
||||
isLongPress() {
|
||||
if (this.longpress) {
|
||||
this.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
updateAndGetChecked() {
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
return this.isChecked
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
@@ -196,79 +242,74 @@ export struct NoteItemComp {
|
||||
Column({ space: 2 }) {
|
||||
Row({ space: 8 }) {
|
||||
Image($r("app.media.verticalBar"))
|
||||
.height(this.portraitModel ? 16 : '8lpx')
|
||||
.width(this.portraitModel ? 4 : '2lpx')
|
||||
.id(this.isUpdate + '')
|
||||
.height(16)
|
||||
.width(4)
|
||||
.fillColor(NoteUtil.getVerticalBarBgColor(AppStorage.Get('AllFolderArray'), this.noteItem.folder_uuid))
|
||||
Text() {
|
||||
ForEach(this.spans.map((item1, index1) => {
|
||||
return { index: index1, data: item1 }
|
||||
}), item => {
|
||||
|
||||
if (item.data.type == 0) {
|
||||
Span(item.data.text)
|
||||
.fontColor($r("app.color.note_title_font_color"))
|
||||
.fontSize(this.portraitModel ? 16 : '8lpx')
|
||||
.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')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
},
|
||||
item => item.index)
|
||||
}.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
Text(this.noteItem.title)
|
||||
.fontSize(16)
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
}
|
||||
|
||||
Row({ space: 4 }) {
|
||||
Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time)))
|
||||
.fontSize(this.portraitModel ? 14 : '7lpx')
|
||||
.id(this.isUpdate + '')
|
||||
.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' })
|
||||
.id(this.isUpdate + '')
|
||||
.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')
|
||||
.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.updateAndGetChecked() ? Visibility.Visible : Visibility.None)
|
||||
.id(this.isUpdate + '')
|
||||
}.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]]
|
||||
@@ -276,15 +317,18 @@ export struct NoteItemComp {
|
||||
.onClick(() => {
|
||||
if (this.search) {
|
||||
this.search = false
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
return
|
||||
}
|
||||
if (this.longpress) {
|
||||
if (NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)) {
|
||||
NoteUtil.unsetNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
} else {
|
||||
NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@@ -317,6 +361,7 @@ export struct NoteItemComp {
|
||||
if (this.longpress == false) {
|
||||
this.longpress = true
|
||||
NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
}
|
||||
})
|
||||
)
|
||||
@@ -327,7 +372,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
|
||||
@@ -336,9 +381,26 @@ export struct NoteItemListComp {
|
||||
@Consume('SearchResultList') searchResultList: NoteData[]
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@State dateList: NoteData[] = []
|
||||
controllerShow: WebController
|
||||
@StorageLink('isUpdate') @Watch('updateList') isUpdate: boolean = false
|
||||
|
||||
updateList() {
|
||||
if (this.isUpdate) {
|
||||
this.dateList = NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
}
|
||||
this.isUpdate = false
|
||||
this.doSearch()
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
this.dateList = NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
}
|
||||
|
||||
doSearch() {
|
||||
if (this.inputKeyword.length == 0) {
|
||||
return
|
||||
}
|
||||
SearchModel.search(NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid), this.inputKeyword)
|
||||
.then((result: NoteData[]) => {
|
||||
LogUtil.info(TAG, "result size " + result.length.toString())
|
||||
@@ -367,12 +429,13 @@ export struct NoteItemListComp {
|
||||
Flex() {
|
||||
SearchComp()
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.width("100%")
|
||||
.padding({ left: 24, right: 24, bottom: 12 })
|
||||
.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)
|
||||
@@ -395,13 +458,14 @@ export struct NoteItemListComp {
|
||||
.fontColor($r("app.color.Empty_page_font_color"))
|
||||
}
|
||||
}
|
||||
.id(this.isUpdate + '')
|
||||
.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) => {
|
||||
this.dateList : this.searchResultList, (noteItem) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
NoteItemComp({
|
||||
@@ -412,9 +476,14 @@ export struct NoteItemListComp {
|
||||
}
|
||||
.padding({ left: 24, right: 24, bottom: 12 })
|
||||
}
|
||||
}, noteItem => noteItem.uuid.toString())
|
||||
}, noteItem => JSON.stringify(noteItem))
|
||||
}
|
||||
.margin((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? { bottom: 0 } : { bottom: 130 })
|
||||
.id(this.isUpdate + '')
|
||||
.margin((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? {
|
||||
bottom: 0
|
||||
} : {
|
||||
bottom: 56
|
||||
})
|
||||
.layoutWeight(1)
|
||||
.listDirection(Axis.Vertical)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
@@ -438,6 +507,8 @@ export struct NoteItemListComp {
|
||||
}
|
||||
.onClick(() => {
|
||||
this.search = false
|
||||
inputMethod.getController().stopInputSession()
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -445,13 +516,14 @@ 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
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@Consume('selectedAll') selectedAll: boolean
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
controllerShow: WebController
|
||||
noteDataMoveDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }),
|
||||
@@ -479,6 +551,7 @@ export struct OperateNoteComp {
|
||||
this.longpress = false
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@@ -518,6 +591,7 @@ export struct OperateNoteComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "OperateNoteComp, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
build() {
|
||||
@@ -527,7 +601,7 @@ export struct OperateNoteComp {
|
||||
.height(24)
|
||||
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
|
||||
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 24 })
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 18 })
|
||||
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible)
|
||||
.onClick(() => {
|
||||
this.CheckedNoteArray.forEach((noteItem) => {
|
||||
@@ -539,13 +613,14 @@ export struct OperateNoteComp {
|
||||
})
|
||||
this.longpress = false
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Image($r('app.media.move'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
|
||||
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 24 })
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 18 })
|
||||
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible)
|
||||
.onClick(() => {
|
||||
this.noteDataMoveDialogCtl.open()
|
||||
@@ -553,7 +628,7 @@ export struct OperateNoteComp {
|
||||
Image($r('app.media.delete'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.margin({ right: 24 })
|
||||
.margin({ right: 18 })
|
||||
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
|
||||
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
|
||||
.onClick(() => {
|
||||
@@ -564,7 +639,7 @@ export struct OperateNoteComp {
|
||||
.height(24)
|
||||
.opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1)
|
||||
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 24 : 0 })
|
||||
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 18 : 0 })
|
||||
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None)
|
||||
.onClick(() => {
|
||||
this.CheckedNoteArray.forEach((noteItem) => {
|
||||
@@ -573,7 +648,7 @@ export struct OperateNoteComp {
|
||||
let context: any = getContext(this)
|
||||
let resource = {
|
||||
bundleName: "com.ohos.note",
|
||||
moduleName: "tablet",
|
||||
moduleName: "default",
|
||||
id: $r('app.string.restore').id
|
||||
};
|
||||
context.resourceManager.getString(resource, (error, value) => {
|
||||
@@ -590,30 +665,33 @@ export struct OperateNoteComp {
|
||||
})
|
||||
this.longpress = false
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Image(this.CheckedNoteArray.length == NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length ? $r('app.media.check_all1') : $r('app.media.check_all'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.id(this.isUpdate + '')
|
||||
.onClick(() => {
|
||||
LogUtil.info(TAG, "select all click")
|
||||
if (this.CheckedNoteArray.length <
|
||||
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
.length) {
|
||||
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length) {
|
||||
NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid))
|
||||
} else {
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
}
|
||||
this.selectedAll = !this.selectedAll
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}
|
||||
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : 168)
|
||||
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 168 : 248)
|
||||
.visibility(this.longpress && this.portraitModel == false ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
}
|
||||
|
||||
@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 +711,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)
|
||||
@@ -659,6 +737,7 @@ export struct AddNoteComp {
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "addNote, set continue note success")
|
||||
routePage()
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
})
|
||||
.visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
@@ -670,6 +749,7 @@ export struct SearchComp {
|
||||
@Consume('InputKeyword') inputKeyword: string
|
||||
@Consume('Longpress') longpress: boolean
|
||||
@State text: string = ''
|
||||
@StorageLink('isFocusOnSearch') isFocusOnSearch: boolean = true
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
@@ -680,19 +760,27 @@ export struct SearchComp {
|
||||
.margin({ right: this.search ? 16 : 0 })
|
||||
.visibility(this.search ? Visibility.Visible : Visibility.None)
|
||||
.onClick(() => {
|
||||
focusControl.requestFocus('searchFocus')
|
||||
this.search = false
|
||||
// 退出键盘
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
})
|
||||
|
||||
Flex({ justifyContent: FlexAlign.Start }) {
|
||||
Image($r('app.media.search')).width(20).height(20)
|
||||
.focusable(true)
|
||||
.key('searchFocus')
|
||||
.defaultFocus(true)
|
||||
TextInput({ placeholder: $r('app.string.searchNote'), text: this.text })
|
||||
.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) {
|
||||
@@ -704,10 +792,22 @@ export struct SearchComp {
|
||||
.onClick(() => {
|
||||
if (this.longpress) {
|
||||
this.search = false
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
} else {
|
||||
this.search = true
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
}
|
||||
})
|
||||
// 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('searchInput')
|
||||
.restoreId(3)
|
||||
}
|
||||
.backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") : $r("app.color.color_ffffff"))
|
||||
.height(40)
|
||||
@@ -723,13 +823,14 @@ 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
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@State greyOpacity: boolean = false
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
noteDataMoveDialogCtlBottom: CustomDialogController = new CustomDialogController({
|
||||
builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
@@ -763,6 +864,7 @@ export struct OperateNoteCompForPortrait {
|
||||
this.longpress = false
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({
|
||||
@@ -799,6 +901,7 @@ export struct OperateNoteCompForPortrait {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "OperateNoteCompForPortrait, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
build() {
|
||||
@@ -821,6 +924,7 @@ export struct OperateNoteCompForPortrait {
|
||||
this.longpress = false
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.set_top"))
|
||||
.opacity(this.greyOpacity ? 0.4 : 1)
|
||||
@@ -844,6 +948,7 @@ export struct OperateNoteCompForPortrait {
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.onClick(() => {
|
||||
this.noteDataDeleteDialogCtlBottom.open()
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
})
|
||||
Text($r("app.string.delete"))
|
||||
.opacity(this.greyOpacity ? 0.4 : 1)
|
||||
@@ -851,7 +956,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)
|
||||
@@ -867,6 +972,7 @@ export struct OperateNoteCompForPortrait {
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.onClick(() => {
|
||||
this.noteDataMoveDialogCtlBottom.open()
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
})
|
||||
Text($r("app.string.move"))
|
||||
.opacity(this.greyOpacity ? 0.4 : 1)
|
||||
@@ -896,7 +1002,7 @@ export struct OperateNoteCompForPortrait {
|
||||
let context: any = getContext(this)
|
||||
let resource = {
|
||||
bundleName: "com.ohos.note",
|
||||
moduleName: "tablet",
|
||||
moduleName: "default",
|
||||
id: $r('app.string.restore').id
|
||||
};
|
||||
context.resourceManager.getString(resource, (error, value) => {
|
||||
@@ -914,13 +1020,15 @@ export struct OperateNoteCompForPortrait {
|
||||
this.longpress = false
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
AppStorage.SetOrCreate('isUpdate', true)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.recover"))
|
||||
.fontSize(10)
|
||||
.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)
|
||||
@@ -933,22 +1041,24 @@ export struct OperateNoteCompForPortrait {
|
||||
.width(24)
|
||||
.height(24)
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.id(this.isUpdate + '')
|
||||
.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)
|
||||
}
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.check_all"))
|
||||
.fontSize(10)
|
||||
.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)
|
||||
@@ -18,6 +18,7 @@
|
||||
"name": "component",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"uiSyntax": "ets"
|
||||
Generated
+1234
-1655
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -11,9 +11,10 @@
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@ohos/hvigor": "1.0.6",
|
||||
"@ohos/hvigor-ohos-plugin": "1.0.6",
|
||||
"@ohos/hypium": "1.0.2",
|
||||
"@ohos/hvigor-ohos-plugin": "1.2.2",
|
||||
"hypium": "^1.0.0",
|
||||
"@ohos/hvigor": "1.2.2",
|
||||
"js-base64": "^3.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
/build
|
||||
/package.json
|
||||
@@ -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"
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import AbilityStage from "@ohos.application.AbilityStage"
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
+72
-8
@@ -13,21 +13,33 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ability from '@ohos.application.Ability'
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import AbilityConstant from '@ohos.application.AbilityConstant'
|
||||
import AbilityConstant from '@ohos.app.ability.AbilityConstant'
|
||||
import fileio from '@ohos.fileio'
|
||||
import inputMethod from '@ohos.inputmethod';
|
||||
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';
|
||||
import window from '@ohos.window';
|
||||
|
||||
globalThis.rdbStore = undefined
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
private Tag = "MainAbility_Tablet"
|
||||
|
||||
onCreate(want, launchParam) {
|
||||
AppStorage.SetOrCreate<boolean>('closeEditContentDialog', true)
|
||||
LogUtil.info(this.Tag, " onCreate, launchReason is " + launchParam.launchReason)
|
||||
LogUtil.info(this.Tag, " onCreate, deviceType" + deviceInfo.deviceType)
|
||||
// @ts-ignore
|
||||
window.getLastWindow(this.context, (err, data) => {
|
||||
if (data && data.getWindowProperties()) {
|
||||
let windowWidth = data.getWindowProperties().windowRect.width
|
||||
LogUtil.info(this.Tag, " getLastWindow:" + windowWidth)
|
||||
this.screenBreakPoints(windowWidth)
|
||||
} else {
|
||||
LogUtil.info(this.Tag, "getWindowProperties error:" + JSON.stringify(err))
|
||||
}
|
||||
})
|
||||
LogUtil.info(this.Tag, " onCreate, launchReason is " + launchParam.launchReason + ", deviceType" + deviceInfo.deviceType)
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
AppStorage.SetOrCreate<boolean>('Expand', false)
|
||||
AppStorage.SetOrCreate<boolean>('Choose', true)
|
||||
@@ -36,11 +48,18 @@ export default class MainAbility extends Ability {
|
||||
// 设置迁移标记
|
||||
AppStorage.SetOrCreate<boolean>('IsContinue', true)
|
||||
// 获取对端的迁移数据
|
||||
let Search: boolean = want.parameters["Search"]
|
||||
let continueNote: string = want.parameters["ContinueNote"]
|
||||
let continueSection: number = want.parameters["ContinueSection"]
|
||||
let scrollTopPercent: number = want.parameters["ScrollTopPercent"]
|
||||
let isFocusOnSearch: boolean = want.parameters["isFocusOnSearch"]
|
||||
LogUtil.info(this.Tag, " continueSection : " + continueSection)
|
||||
AppStorage.SetOrCreate<boolean>('Search', Search)
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', continueSection)
|
||||
// 使用新的key保存数据,防止迁移过来的数据在使用前被本地操作覆盖
|
||||
AppStorage.SetOrCreate<number>('remoteScrollTopPercent', scrollTopPercent)
|
||||
AppStorage.SetOrCreate<boolean>('isRemoteFocusOnSearch', isFocusOnSearch)
|
||||
// 来自手机的迁移
|
||||
let continueChoose: boolean = want.parameters["ContinueChoose"]
|
||||
if (continueChoose) {
|
||||
@@ -60,6 +79,17 @@ export default class MainAbility extends Ability {
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
windowStage.getMainWindow((err, data) => {
|
||||
let windowClass = data
|
||||
try {
|
||||
windowClass.on('windowSizeChange', (data) => {
|
||||
this.screenBreakPoints(data.width)
|
||||
})
|
||||
} catch (exception) {
|
||||
LogUtil.info(this.Tag, 'windowSizeChange fail')
|
||||
}
|
||||
})
|
||||
|
||||
LogUtil.info(this.Tag, " onWindowStageCreate")
|
||||
windowStage.setUIContent(this.context, "pages/MyNoteHome", null)
|
||||
}
|
||||
@@ -75,12 +105,14 @@ export default class MainAbility extends Ability {
|
||||
onBackground() {
|
||||
LogUtil.info(this.Tag, " onBackground")
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
}
|
||||
|
||||
onContinue(wantParam: { [key: string]: any }) {
|
||||
LogUtil.info(this.Tag, " onContinue")
|
||||
// 获取本端的迁移数据
|
||||
let Search = AppStorage.Get<boolean>('Search')
|
||||
let continueNote = AppStorage.Get<string>('ContinueNote')
|
||||
if (continueNote == undefined || continueNote == null) {
|
||||
LogUtil.info(this.Tag, " onContinue, continueNote is error, default [0]")
|
||||
@@ -94,9 +126,24 @@ export default class MainAbility extends Ability {
|
||||
}
|
||||
LogUtil.info(this.Tag, " onContinue, continueSection : " + continueSection)
|
||||
|
||||
let scrollTopPercent = AppStorage.Get<number>('ScrollTopPercent')
|
||||
if (scrollTopPercent == undefined || scrollTopPercent == null) {
|
||||
LogUtil.info(this.Tag, " onContinue, scrollTopPercent is error, default 0")
|
||||
scrollTopPercent = 0
|
||||
}
|
||||
|
||||
let isFocusOnSearch = AppStorage.Get<boolean>('isFocusOnSearch')
|
||||
if (isFocusOnSearch == undefined || isFocusOnSearch == null) {
|
||||
LogUtil.info(this.Tag, " onContinue, isFocusOnSearch is error, default true")
|
||||
isFocusOnSearch = true
|
||||
}
|
||||
|
||||
// 保存本端的迁移数据
|
||||
wantParam["Search"] = Search
|
||||
wantParam["ContinueNote"] = continueNote
|
||||
wantParam["ContinueSection"] = continueSection
|
||||
wantParam["ScrollTopPercent"] = scrollTopPercent
|
||||
wantParam["isFocusOnSearch"] = isFocusOnSearch
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
wantParam["ContinueChoose"] = true
|
||||
}
|
||||
@@ -116,7 +163,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
|
||||
@@ -156,4 +203,21 @@ export default class MainAbility extends Ability {
|
||||
LogUtil.warn(this.Tag, " onContinue, writeToDisFileDir, copyFile failed : " + err)
|
||||
}
|
||||
}
|
||||
|
||||
screenBreakPoints(data) {
|
||||
let displayClass = null
|
||||
let screenDpi = null
|
||||
displayClass = display.getDefaultDisplaySync()
|
||||
screenDpi = displayClass.densityDPI
|
||||
AppStorage.SetOrCreate('dpi', screenDpi)
|
||||
let windowWidth = data / (screenDpi / 160)
|
||||
LogUtil.debug(this.Tag, " screenBreakPoints windowWidth: " + windowWidth)
|
||||
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')
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
-41
@@ -14,13 +14,15 @@
|
||||
*/
|
||||
|
||||
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 deviceInfo from '@ohos.deviceInfo';
|
||||
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 inputMethod from '@ohos.inputmethod'
|
||||
import router from '@system.router'
|
||||
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
import router from '@system.router';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@@ -28,45 +30,48 @@ export struct MyNoteHomeComp {
|
||||
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
|
||||
@Provide('PortraitModel') portraitModel: boolean = true
|
||||
@Provide('RefreshFlag') refreshFlag: number = 0
|
||||
private controllerShow: WebController = new WebController()
|
||||
private context = getContext(this)
|
||||
TAG = "MyNoteHomeComp_Phone"
|
||||
TAG = "MyNoteHomeComp_Tablet"
|
||||
@StorageLink('breakPoint') @Watch('onBreakPointChange') breakPoints: string = 'lg'
|
||||
|
||||
build() {
|
||||
Flex() {
|
||||
if (this.dBQueryFinished == 1) {
|
||||
NoteHomePortraitComp()
|
||||
}
|
||||
onBreakPointChange() {
|
||||
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
|
||||
this.portraitModel = true
|
||||
} else {
|
||||
this.portraitModel = false
|
||||
}
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
LogUtil.info(this.TAG, "aboutToAppear")
|
||||
build() {
|
||||
Row() {
|
||||
if (this.dBQueryFinished == 1) {
|
||||
if (this.breakPoints == 'sm') {
|
||||
NoteHomePortraitComp()
|
||||
} else {
|
||||
NoteHomeComp({ controllerShow: this.controllerShow })
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info(this.TAG, "aboutToAppear")
|
||||
this.breakPoints = AppStorage.Get('breakPoint')
|
||||
if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
|
||||
this.portraitModel = true
|
||||
} else {
|
||||
this.portraitModel = false
|
||||
}
|
||||
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 {
|
||||
@@ -79,24 +84,23 @@ 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")
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
// continue from tablet
|
||||
let continueFromTablet = AppStorage.Get<boolean>('ContinueFromTablet')
|
||||
LogUtil.info(this.TAG, "onPageShow, continueFromTablet : " + continueFromTablet)
|
||||
@@ -106,11 +110,13 @@ export struct MyNoteHomeComp {
|
||||
router.push({ uri: 'pages/NoteContentHome' })
|
||||
AppStorage.SetOrCreate<boolean>('ContinueFromTablet', false)
|
||||
}
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
}
|
||||
|
||||
onBackPress():void{
|
||||
onBackPress() {
|
||||
LogUtil.info(this.TAG, "onBackPress")
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -14,11 +14,11 @@
|
||||
*/
|
||||
|
||||
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'
|
||||
import inputMethod from '@ohos.inputMethod'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@@ -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,18 @@ 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') {
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
}
|
||||
}
|
||||
|
||||
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 +68,4 @@ struct NoteContentHome {
|
||||
AppStorage.SetOrCreate<boolean>('NoteContentHomeExist', true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* 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 = AppStorage.Get('Search') // 是否处于搜索状态
|
||||
@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"
|
||||
@Provide('AsideWidth') asideWidth: number = 200
|
||||
|
||||
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(this.asideWidth)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.animation({ duration: 200 })
|
||||
.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)
|
||||
}
|
||||
|
||||
// 蒙层
|
||||
if (this.expandStatus) {
|
||||
Column()
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.position({ x: 0, y: 0 })
|
||||
.backgroundColor(Color.Black)
|
||||
.opacity(0.2)
|
||||
.transition({ opacity: 0 })
|
||||
}
|
||||
//Folder list display area
|
||||
Column() {
|
||||
FolderListComp()
|
||||
}
|
||||
.width(200)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.translate({ x: this.expandStatus ? 0 : '-200', y: 0 })
|
||||
}
|
||||
.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 = 1
|
||||
}
|
||||
// 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")
|
||||
}
|
||||
}
|
||||
+18
-8
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FolderListComp, FolderListBackGround } from '@ohos/component/src/main/ets/components/FolderListComp'
|
||||
import { FolderListComp } 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'
|
||||
@@ -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 // 是否处于搜索状态
|
||||
@@ -46,10 +46,10 @@ export struct NoteHomePortraitComp {
|
||||
@Provide('SelectedAll') selectedAll: boolean = false;
|
||||
@Provide('EditModel') editModel: boolean = false
|
||||
TAG = "NoteHomePortraitComp_Phone"
|
||||
@Provide('AsideWidth') asideWidth: number = 200
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.Start }) {
|
||||
|
||||
// Note list display area
|
||||
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
|
||||
NoteListComp()
|
||||
@@ -59,23 +59,33 @@ export struct NoteHomePortraitComp {
|
||||
.enabled(this.expandStatus ? false : true)
|
||||
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
|
||||
|
||||
// 蒙层
|
||||
if (this.expandStatus) {
|
||||
Column()
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.position({ x: 0, y: 0 })
|
||||
.backgroundColor(Color.Black)
|
||||
.opacity(0.2)
|
||||
.transition({ opacity: 0 })
|
||||
}
|
||||
//Folder list display area
|
||||
Stack() {
|
||||
FolderListBackGround()
|
||||
Column() {
|
||||
FolderListComp()
|
||||
}
|
||||
.width(200)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible)
|
||||
.position({ x: 0, y: 0 })
|
||||
.translate({ x: this.expandStatus ? 0 : '-200', y: 0 })
|
||||
}
|
||||
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
|
||||
aboutToAppear(): void{
|
||||
aboutToAppear(): void {
|
||||
LogUtil.info(this.TAG, "aboutToAppear")
|
||||
}
|
||||
|
||||
aboutToDisappear(): void{
|
||||
aboutToDisappear(): void {
|
||||
LogUtil.info(this.TAG, "aboutToDisappear")
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
{
|
||||
"module": {
|
||||
"name": "tablet",
|
||||
"name": "default",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:entry_MainAbility",
|
||||
@@ -44,11 +45,20 @@
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"reason": "$string:distributed_dataSync_permission"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
|
||||
}
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ArkTSPartialUpdate",
|
||||
"value": "true"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
@@ -57,6 +67,7 @@
|
||||
"icon": "$media:note",
|
||||
"label": "$string:entry_MainAbility",
|
||||
"visible": true,
|
||||
"continuable": true,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
@@ -1,3 +0,0 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import AbilityStage from "@ohos.application.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -1,70 +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,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"startWindowBackground": "$color:color_1",
|
||||
"startWindowIcon": "$media:note"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/MyNoteHome",
|
||||
"pages/NoteContentHome",
|
||||
"pages/NoteHomePortrait"
|
||||
]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "read_media_permission",
|
||||
"value": "用于备忘录读取用户外部存储中的媒体文件信息"
|
||||
},
|
||||
{
|
||||
"name": "media_location_permission",
|
||||
"value": "用于备忘录访问用户媒体文件中的地理位置信息"
|
||||
},
|
||||
{
|
||||
"name": "distributed_dataSync_permission",
|
||||
"value": "用于备忘录进行不同设备间的数据交换"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
@@ -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
|
||||
Generated
-45
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,142 +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 deviceInfo from '@ohos.deviceInfo';
|
||||
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';
|
||||
import router from '@system.router';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
export struct MyNoteHomeComp {
|
||||
@StorageLink('DBQueryFinished') dBQueryFinished: number = 0
|
||||
@Provide('PortraitModel') portraitModel: boolean = (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default')
|
||||
@Provide('RefreshFlag') refreshFlag: number = 0
|
||||
private controllerShow: WebController = new WebController()
|
||||
private context = getContext(this)
|
||||
TAG = "MyNoteHomeComp_Tablet"
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
if (this.dBQueryFinished == 1) {
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
NoteHomePortraitComp()
|
||||
} else {
|
||||
NoteHomeComp({ controllerShow: this.controllerShow })
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.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.WRITE_MEDIA",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
]
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
permissionList = [
|
||||
"ohos.permission.READ_MEDIA",
|
||||
"ohos.permission.WRITE_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")
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
// 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)
|
||||
}
|
||||
} else {
|
||||
let currentNote = AppStorage.Get<NoteData>('NewNote')
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
}
|
||||
|
||||
onBackPress() {
|
||||
LogUtil.info(this.TAG, "onBackPress")
|
||||
// 退出键盘
|
||||
inputMethod.getInputMethodController().stopInput();
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "color_1",
|
||||
"value": "#fff"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"version-name": "2.0.0",
|
||||
"version-code": 2,
|
||||
"app-distribution-type": "os_integration",
|
||||
"uuid": "5027b99e-5f9e-465d-9508-a9e0134ffe18",
|
||||
"validity": {
|
||||
"not-before": 1594865258,
|
||||
"not-after": 1689473258
|
||||
},
|
||||
"type": "release",
|
||||
"bundle-info": {
|
||||
"developer-id": "OpenHarmony",
|
||||
"distribution-certificate": "-----BEGIN CERTIFICATE-----\nMIICFDCCAZmgAwIBAgIEfc9FYzAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO\nMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh\nbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjIxMjIx\nMDM0MjA3WhcNMzIxMjE4MDM0MjA3WjBKMRUwEwYDVQQDDAxpZGVfZGVtb19hcHAx\nDTALBgNVBAsTBFVuaXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UEBhMC\nQ04wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATB+nRPXBTqJciFQWBaHGoEZFUs\nB2g+vVAkO2mqzvC4EvHSZXABHQ9TfmNn5G2ew2pzIvzhVhpD+4Vgt6xLhlQPo1Iw\nUDAdBgNVHQ4EFgQUc1K0TS4hsnNYulx1ZK65mBYoTSMwDgYDVR0PAQH/BAQDAgeA\nMB8GA1UdIwQYMBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMAwGCCqGSM49BAMDBQAD\nZwAwZAIwH7iB1wE7x0wAQcyqOcycLi7BTyL9hWkTkp4CSRew6xdOfPDmYuPKv/85\nQw8tj4n2AjAPbFMRSrs4cJEIix5PDGxfe89u/JtAmlvKQCmIze1ivrbiXVu3nVsA\nZ0RDZPYTSqc\u003d\n-----END CERTIFICATE-----\n",
|
||||
"bundle-name": "com.ohos.note",
|
||||
"apl": "normal",
|
||||
"app-feature": "hos_normal_app"
|
||||
},
|
||||
"acls": {
|
||||
"allowed-acls": [
|
||||
"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
|
||||
]
|
||||
},
|
||||
"permissions": {
|
||||
"restricted-permissions": []
|
||||
},
|
||||
"issuer": "pki_internal"
|
||||
}
|
||||
Reference in New Issue
Block a user