chendeben před 1 rokem
rodič
revize
77e310d684

+ 3 - 3
entry/src/main/ets/pages/AboutPage.ets

@@ -112,7 +112,7 @@ export struct AboutPage{
         // 顶部安全区
         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() {
@@ -139,7 +139,7 @@ export struct AboutPage{
         }
         .height(48)
         .width('100%')
-        .backgroundColor(this.themeColor)
+        .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
       }
       Scroll(){
 
@@ -221,7 +221,7 @@ export struct AboutPage{
 
       }
       .height(px2vp(DisplayUtil.getHeight()-AppUtil.getStatusBarHeight()-AppUtil.getNavigationIndicatorHeight()))
-      .backgroundColor(this.themeColor)
+      .backgroundColor(this.isDarkMode?Color.Black:this.themeColor)
       .linearGradient(!this.isDarkMode ? {colors:[[this.themeColor, 0.0], [this.getGradientColor(this.themeColor, 40), 0.6]]} : undefined)
     }
   }

+ 10 - 3
entry/src/main/ets/pages/ScanFilePage.ets

@@ -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%')

+ 2 - 2
entry/src/main/ets/pages/SettingPage.ets

@@ -204,7 +204,7 @@ export struct SettingPage {
         Line().width('100%').height('100%')
       }
       .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() {
@@ -231,7 +231,7 @@ export struct SettingPage {
       }
       .height(48)
       .width('100%')
-      .backgroundColor(this.themeColor)
+      .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
       Scroll() {
         Column() {
           // 主题设置分组

+ 10 - 4
entry/src/main/ets/pages/VipPage.ets

@@ -21,7 +21,7 @@ import { fileUri, picker } from '@kit.CoreFileKit';
 import { VipData } from '../viewmodel/VipData';
 import { LocalMusic } from '../view/LocalMusic';
 import { DialogHelper } from '@pura/harmony-dialog';
-import { common } from '@kit.AbilityKit';
+import { common, ConfigurationConstant } from '@kit.AbilityKit';
 import * as wxOpenSdk from '@tencent/wechat_open_sdk';
 import { OnWXResp, WXApi, WXEventHandler } from '../common/util/WXApiWrap';
 import { ErrCode } from '@tencent/wechat_open_sdk';
@@ -82,7 +82,12 @@ export  struct  VipPage{
   static readonly WX_NOTIFY_URL: string = 'https://webhook.ss5.xyz/wechat_notify.php'
 
   @StorageProp('themeColor') themeColor: string = '#FF4081';
-
+  @State isDarkMode: boolean = false
+  @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
+    ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
+  onColorModeChange() {
+    this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
+  }
   // 组件生命周期
   async aboutToAppear() {
     this.isAgree = PreferencesUtil.getBooleanSync(VipPage.IS_AGREE,false)
@@ -92,6 +97,7 @@ export  struct  VipPage{
     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 })
     let download_path = new fileUri.FileUri(documentSaveResult[0]).path + '/'
@@ -145,7 +151,7 @@ export  struct  VipPage{
         // 顶部安全区
         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() {
@@ -172,7 +178,7 @@ export  struct  VipPage{
         }
         .height(48)
         .width('100%')
-        .backgroundColor(this.themeColor)
+        .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
       }
       Scroll() {
       Column() {

+ 2 - 2
entry/src/main/ets/pages/WebIndex.ets

@@ -69,7 +69,7 @@ struct  WebIndex{
         // 顶部安全区
         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() {
@@ -96,7 +96,7 @@ struct  WebIndex{
         }
         .height(48)
         .width('100%')
-        .backgroundColor(this.themeColor)
+        .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
       }
       Web({
         src: this.params?.['webUrl'],