适配改变颜色按钮点击几次后不反应问题;适配搜索白屏问题;修改列表布局抖动问题

Signed-off-by: nobbo <gaoshang22@huawei.com>
This commit is contained in:
nobbo
2022-10-09 11:20:02 +08:00
parent db4789f833
commit cdfdfd3919
5 changed files with 30 additions and 6 deletions
@@ -728,6 +728,7 @@ 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
@@ -745,6 +746,7 @@ export struct EditContentDialogPortrait {
.fillColor($r("app.color.font_stylecolor_AD182431"))
.onClick(() => {
this.editContentDialogCtl.close()
this.CloseEditContentDialog = true
})
}
.height(48)
@@ -39,6 +39,7 @@ 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')
@Provide('Issave') issave: number = 0
@@ -155,7 +156,9 @@ export struct NoteContent {
clearInterval(timeID)
}
timeID = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
if(this.CloseEditContentDialog){
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
}
}, 3000)
LogUtil.info(TAG, "setInterval timeID : " + timeID)
this.issave = 0
@@ -180,6 +183,7 @@ 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')
@Consume('Issave') issave: number
@@ -190,8 +194,13 @@ 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 })
}
@@ -256,6 +265,7 @@ export struct ToolBarComp {
// 退出键盘
inputMethod.getInputMethodController().stopInput();
LogUtil.info(TAG, 'editContentDialogCtl start')
this.CloseEditContentDialog = false
this.editContentDialogCtl.open()
})
}.width(42)
@@ -422,6 +422,7 @@ export struct ToolBarComp {
alignment: DialogAlignment.Bottom,
autoCancel: true,
customStyle: true,
cancel: this.exisApp
})
exisApp() {
@@ -52,6 +52,7 @@ export struct NoteContentCompPortrait {
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder")
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
@Provide('EditModel') editModel: boolean = false
@StorageLink('CloseEditContentDialog') CloseEditContentDialog: boolean = AppStorage.Link('CloseEditContentDialog')
controllerShow: WebController
private editContentFlag = false
noteContent = {
@@ -157,7 +158,9 @@ export struct NoteContentCompPortrait {
}
// 添加定时器:3s自动保存
time_id = setInterval(() => {
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
if(this.CloseEditContentDialog){
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
}
}, 3000)
LogUtil.info(TAG, "setInterval time_id : " + time_id)
this.editModel = true
@@ -516,14 +519,20 @@ export struct EditNoteCompForPortrait {
@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 })
}
@@ -555,6 +564,7 @@ export struct EditNoteCompForPortrait {
.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"))
@@ -362,7 +362,7 @@ export struct NoteItemListComp {
}
build() {
Flex({ direction: FlexDirection.Column }) {
Column() {
Text(this.refreshFlag.toString()).visibility(Visibility.None)
Flex() {
SearchComp()
@@ -414,6 +414,7 @@ export struct NoteItemListComp {
}
}, noteItem => noteItem.uuid.toString())
}
.margin((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? { bottom: 0 } : { bottom: 130 })
.layoutWeight(1)
.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
@@ -434,9 +435,7 @@ export struct NoteItemListComp {
.opacity(0.1)
.visibility(this.search ? Visibility.Visible : Visibility.Hidden)
}
.flexShrink(1)
}
.flexShrink(1)
.onClick(() => {
this.search = false
})
@@ -670,6 +669,7 @@ export struct SearchComp {
@Consume('Search') search: boolean
@Consume('InputKeyword') inputKeyword: string
@Consume('Longpress') longpress: boolean
@State text: string = ''
build() {
Row() {
@@ -685,7 +685,7 @@ export struct SearchComp {
Flex({ justifyContent: FlexAlign.Start }) {
Image($r('app.media.search')).width(20).height(20)
TextInput({ placeholder: $r('app.string.searchNote') })
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)
@@ -697,6 +697,7 @@ export struct SearchComp {
.onChange((value: string) => {
if (!this.longpress) {
LogUtil.info(TAG, "Search value: " + value)
this.text = value
this.inputKeyword = value
}
})