|
@@ -7,7 +7,7 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
|
import common from '@ohos.app.ability.common';
|
|
import common from '@ohos.app.ability.common';
|
|
|
import { photoAccessHelper } from '@kit.MediaLibraryKit'
|
|
import { photoAccessHelper } from '@kit.MediaLibraryKit'
|
|
|
import { fileIo, fileUri } from '@kit.CoreFileKit'
|
|
import { fileIo, fileUri } from '@kit.CoreFileKit'
|
|
|
-import { BusinessError } from '@kit.BasicServicesKit'
|
|
|
|
|
|
|
+import { BusinessError, emitter } from '@kit.BasicServicesKit'
|
|
|
import { BreakpointTypeEnum } from '../common/util/BreakpointSystem'
|
|
import { BreakpointTypeEnum } from '../common/util/BreakpointSystem'
|
|
|
|
|
|
|
|
@Preview
|
|
@Preview
|
|
@@ -284,7 +284,7 @@ export struct SettingPage {
|
|
|
.onChange((checked: boolean) => {
|
|
.onChange((checked: boolean) => {
|
|
|
this.isShowSimi = checked;
|
|
this.isShowSimi = checked;
|
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isShowSimi)
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isShowSimi)
|
|
|
- ToastUtil.showToast('本设置重启才生效')
|
|
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|
|
@@ -307,7 +307,7 @@ export struct SettingPage {
|
|
|
.onChange((checked: boolean) => {
|
|
.onChange((checked: boolean) => {
|
|
|
this.isShowFAV = checked;
|
|
this.isShowFAV = checked;
|
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_FAV, this.isShowFAV)
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_FAV, this.isShowFAV)
|
|
|
- ToastUtil.showToast('本设置重启才生效')
|
|
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|
|
@@ -330,7 +330,7 @@ export struct SettingPage {
|
|
|
.onChange((checked: boolean) => {
|
|
.onChange((checked: boolean) => {
|
|
|
this.isShowHistory = checked;
|
|
this.isShowHistory = checked;
|
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_HISTORY, this.isShowHistory)
|
|
PreferencesUtil.put(SettingPage.IS_SHOW_HISTORY, this.isShowHistory)
|
|
|
- ToastUtil.showToast('本设置重启才生效')
|
|
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|
|
@@ -400,7 +400,7 @@ export struct SettingPage {
|
|
|
.onSelect(async (_index: number, text?: string | undefined) => {
|
|
.onSelect(async (_index: number, text?: string | undefined) => {
|
|
|
this.sortType = _index
|
|
this.sortType = _index
|
|
|
PreferencesUtil.put(SettingPage.SORT_TYPE, this.sortType)
|
|
PreferencesUtil.put(SettingPage.SORT_TYPE, this.sortType)
|
|
|
- ToastUtil.showToast('本设置重启才生效')
|
|
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
.height(55)
|
|
.height(55)
|
|
@@ -428,7 +428,7 @@ export struct SettingPage {
|
|
|
}
|
|
}
|
|
|
.backgroundColor($r('app.color.settings_background_main'))
|
|
.backgroundColor($r('app.color.settings_background_main'))
|
|
|
.borderRadius(20)
|
|
.borderRadius(20)
|
|
|
- .margin({ left: 0, right: 0, top: 0, bottom: 10 })
|
|
|
|
|
|
|
+ .margin({ left: 0, right: 0, top: 10, bottom: 10 })
|
|
|
.padding(0)
|
|
.padding(0)
|
|
|
|
|
|
|
|
// API设置分组
|
|
// API设置分组
|
|
@@ -492,7 +492,7 @@ export struct SettingPage {
|
|
|
}
|
|
}
|
|
|
.backgroundColor($r('app.color.settings_background_main'))
|
|
.backgroundColor($r('app.color.settings_background_main'))
|
|
|
.borderRadius(20)
|
|
.borderRadius(20)
|
|
|
- .margin({ left: 0, right: 0, top: 0, bottom: 10 })
|
|
|
|
|
|
|
+ .margin({ left: 0, right: 0, top: 10, bottom: 30 })
|
|
|
.padding(0)
|
|
.padding(0)
|
|
|
}
|
|
}
|
|
|
.margin({ left: 35, right: 35, top: 20, bottom: 30 })
|
|
.margin({ left: 35, right: 35, top: 20, bottom: 30 })
|
|
@@ -509,6 +509,11 @@ export struct SettingPage {
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //发送广播通知更新UI
|
|
|
|
|
+ sendChangeEvent(){
|
|
|
|
|
+ const eventData: emitter.EventData = {};
|
|
|
|
|
+ emitter.emit({ eventId: 333 }, eventData); // 发送音频广播通知更新doSwipBack
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
goSelectImage() {
|
|
goSelectImage() {
|
|
|
|
|
|
|
@@ -526,7 +531,8 @@ export struct SettingPage {
|
|
|
//使用fs.openSync接口,通过uri打开这个文件得到fd
|
|
//使用fs.openSync接口,通过uri打开这个文件得到fd
|
|
|
let file = fileIo.openSync(selectUris[0], fileIo.OpenMode.READ_ONLY);
|
|
let file = fileIo.openSync(selectUris[0], fileIo.OpenMode.READ_ONLY);
|
|
|
console.info('file fd: ' + file.fd);
|
|
console.info('file fd: ' + file.fd);
|
|
|
- let name = await MD5.digestSync('homeBg')
|
|
|
|
|
|
|
+ const timestamp: number = Math.floor(Date.now() / 1000);
|
|
|
|
|
+ let name = timestamp+"_homebg"
|
|
|
let imagePath = this.context.filesDir + FileUtil.separator + name
|
|
let imagePath = this.context.filesDir + FileUtil.separator + name
|
|
|
imagePath = fileUri.getUriFromPath(imagePath)
|
|
imagePath = fileUri.getUriFromPath(imagePath)
|
|
|
let file2 = fileIo.openSync(imagePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
|
|
let file2 = fileIo.openSync(imagePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
|
|
@@ -537,7 +543,7 @@ export struct SettingPage {
|
|
|
this.customizeBgPath = imagePath
|
|
this.customizeBgPath = imagePath
|
|
|
|
|
|
|
|
PreferencesUtil.put(SettingPage.IS_CUSTOMIZE_BG_PATH, this.customizeBgPath)
|
|
PreferencesUtil.put(SettingPage.IS_CUSTOMIZE_BG_PATH, this.customizeBgPath)
|
|
|
-
|
|
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
|
|
|
|
|
}).catch((err: BusinessError) => {
|
|
}).catch((err: BusinessError) => {
|
|
|
|
|
|
|
@@ -567,7 +573,7 @@ export struct SettingPage {
|
|
|
.objectFit( ImageFit.Contain)
|
|
.objectFit( ImageFit.Contain)
|
|
|
.borderRadius(20)
|
|
.borderRadius(20)
|
|
|
.clip(true)
|
|
.clip(true)
|
|
|
- .margin({ left: 20,bottom:40 })
|
|
|
|
|
|
|
+ .margin({bottom:30 })
|
|
|
|
|
|
|
|
Row() {
|
|
Row() {
|
|
|
|
|
|
|
@@ -580,7 +586,6 @@ export struct SettingPage {
|
|
|
.width(100)
|
|
.width(100)
|
|
|
.backgroundColor($r('app.color.title_bar_bg'))
|
|
.backgroundColor($r('app.color.title_bar_bg'))
|
|
|
.stateEffect(true)
|
|
.stateEffect(true)
|
|
|
- .margin({ right: 5, left: 12 })
|
|
|
|
|
.onClick(async () => {
|
|
.onClick(async () => {
|
|
|
|
|
|
|
|
this.goSelectImage()
|
|
this.goSelectImage()
|
|
@@ -596,7 +601,7 @@ export struct SettingPage {
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(58)
|
|
.height(58)
|
|
|
-
|
|
|
|
|
|
|
+ .margin({ left: 20,bottom:30 })
|
|
|
|
|
|
|
|
Column() {
|
|
Column() {
|
|
|
Row() {
|
|
Row() {
|
|
@@ -613,6 +618,8 @@ export struct SettingPage {
|
|
|
.onChange((checked: boolean) => {
|
|
.onChange((checked: boolean) => {
|
|
|
this.isCustomizeBg = checked;
|
|
this.isCustomizeBg = checked;
|
|
|
PreferencesUtil.put(SettingPage.IS_CUSTOMIZE_BG, this.isCustomizeBg)
|
|
PreferencesUtil.put(SettingPage.IS_CUSTOMIZE_BG, this.isCustomizeBg)
|
|
|
|
|
+
|
|
|
|
|
+ this.sendChangeEvent()
|
|
|
})
|
|
})
|
|
|
.width(50)
|
|
.width(50)
|
|
|
.height(30);
|
|
.height(30);
|