|
|
@@ -14,6 +14,7 @@ import { CommonConstants } from '../common/constants/CommonConstants'
|
|
|
import { emitter } from '@kit.BasicServicesKit'
|
|
|
import { BreakpointTypeEnum } from '../common/util/BreakpointSystem'
|
|
|
import { resourceManager } from '@kit.LocalizationKit'
|
|
|
+import { ConfigurationConstant } from '@kit.AbilityKit'
|
|
|
|
|
|
|
|
|
@Preview
|
|
|
@@ -35,6 +36,9 @@ export struct ScanFilePage{
|
|
|
/** 当前断点类型(如大屏/小屏) */
|
|
|
@StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointTypeEnum.MD;
|
|
|
@StorageProp('themeColor') themeColor: string = '#FF4081';
|
|
|
+ @State isDarkMode: boolean = false
|
|
|
+ @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
|
|
|
+ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
|
|
|
initLottie(lpath:string,isLoop:boolean){
|
|
|
lottie.destroy(); //加载动画前先销毁之前加载的动画
|
|
|
this.animateItem = lottie.loadAnimation({
|
|
|
@@ -61,6 +65,7 @@ export struct ScanFilePage{
|
|
|
let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');
|
|
|
AppStorage.setOrCreate('themeColor', themeColor);
|
|
|
this.themeColor = themeColor;
|
|
|
+ this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
|
|
|
const documentViewPicker = new picker.DocumentViewPicker()
|
|
|
let documentSaveResult = await documentViewPicker.save({ pickerMode: picker.DocumentPickerMode.DOWNLOAD })
|
|
|
this.rootPath = new fileUri.FileUri(documentSaveResult[0]).path
|
|
|
@@ -69,7 +74,9 @@ export struct ScanFilePage{
|
|
|
LogUtil.info('onecold 文件扫描 aboutToAppear')
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ onColorModeChange() {
|
|
|
+ this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
|
|
|
+ }
|
|
|
endScan(){
|
|
|
const eventData: emitter.EventData = {};
|
|
|
emitter.emit({ eventId: 101 }, eventData); // 发送视频打开广播事件
|
|
|
@@ -148,7 +155,7 @@ export struct ScanFilePage{
|
|
|
// 顶部安全区
|
|
|
Blank()
|
|
|
.height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
|
|
|
- .backgroundColor(this.themeColor)
|
|
|
+ .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
|
|
|
// 自定义标题栏(Stack实现绝对居中)
|
|
|
Stack() {
|
|
|
@@ -175,7 +182,7 @@ export struct ScanFilePage{
|
|
|
}
|
|
|
.height(48)
|
|
|
.width('100%')
|
|
|
- .backgroundColor(this.themeColor)
|
|
|
+ .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
|
|
|
}
|
|
|
// Column(){
|
|
|
// Line().width('100%').height('100%')
|