Procházet zdrojové kódy

更改一些颜色和布局,增加我的收藏,私密音频,最近播放的设置开关是否显示

onecold před 1 rokem
rodič
revize
223f232b04

+ 1 - 1
entry/src/main/ets/pages/NewIndex.ets

@@ -443,7 +443,7 @@ struct NewIndex{
     .alignListItem(ListItemAlign.Center)
     .backgroundColor($r('app.color.silvery'))
     .layoutWeight(1)
-    .divider({strokeWidth: 1, color: $r('app.color.divider_color')})
+    // .divider({ strokeWidth: 1, color: this.isDarkMode? '333333':'#ffe9f0f0' })
     .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
   }
 

+ 91 - 6
entry/src/main/ets/pages/SettingPage.ets

@@ -1,7 +1,7 @@
 import TitleBar from '../view/TitleBar'
 import { promptAction, router } from '@kit.ArkUI'
 import { CommonConstants } from '../common/constants/CommonConstants'
-import { AppUtil, PreferencesUtil } from '@pura/harmony-utils'
+import { AppUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils'
 import { CustomContentDialog } from '@kit.ArkUI'
 import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
 import common from '@ohos.app.ability.common';
@@ -20,6 +20,13 @@ export struct SettingPage {
   @State isMusicMemoryPlay: boolean = false //是否启用记忆播放
   @State isMusicBGCover: boolean = true //播放背景随封面
   @State sortType: number = 4 //默认排序方式
+
+  @State isShowSimi:boolean = false //是否显示私密音频
+  @State isShowFAV:boolean = true //是否显示我的收藏
+  @State isShowHistory:boolean = true //是否显示最近播放
+
+
+
   @State showCoverApiDialog: boolean = false
   @State tempCoverApiUrl: string = ''
   @State coverApiUrl: string = PreferencesUtil.getStringSync('COVER_API', '')
@@ -36,15 +43,19 @@ export struct SettingPage {
   static readonly iS_SAVE_PLAY_MODE: string = 'isSavePlayMode';
   static readonly IS_COVER_RECTANGLE: string = 'isCoverRectangle'; //封面圆形或者方形
   static readonly IS_DARK_MODE: string = 'isDarkMode'; // 深色模式设置
+
+  static readonly IS_SHOW_SIMI: string = 'isShowSimi';
+  static readonly IS_SHOW_FAV: string = 'isShowFAV';
+  static readonly IS_SHOW_HISTORY: string = 'isShowHistory';
   @State titleBarModel: TitleBar.Model = new TitleBar.Model()
     .setTitleTextStyle(FontStyle.Normal)
     .setTitleBarStyle(TitleBar.BarStyle.TRANSPARENT)
     .setLeftIcon($r('app.media.left_back_white'))
     .setTitleName('通用设置')
     .setTitleFontColor(Color.White)
-    .setTitleBarBackground($r('app.color.tab_item_bg'))
-    .setLeftTitleBackground($r('app.color.tab_item_bg'))
-    .setTitleBarBottomLineColor($r('app.color.tab_item_bg'))
+    .setTitleBarBackground($r('app.color.title_bar_bg'))
+    .setLeftTitleBackground($r('app.color.title_bar_bg'))
+    .setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
     .setOnLeftClickListener(() => {
       router.back()
     })
@@ -118,6 +129,10 @@ export struct SettingPage {
     this.isMusicMemoryPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false)
     this.isMusicBGCover = PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_BG_COVER, true)
 
+    this.isShowSimi = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SIMI, false)
+    this.isShowFAV = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_FAV, true)
+    this.isShowHistory = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_HISTORY, true)
+
     // 从持久化存储中读取深色模式设置
     const savedDarkMode = PreferencesUtil.getBooleanSync(SettingPage.IS_DARK_MODE, false);
     this.isDarkMode = savedDarkMode;
@@ -175,7 +190,7 @@ export struct SettingPage {
           // 主题设置分组
           Column() {
             Row() {
-              Text('主题设置')
+              Text('个性化')
                 .margin({ left: 18, right: 20 })
                 .fontSize(16)
                 .fontColor(Color.Gray)
@@ -203,6 +218,75 @@ export struct SettingPage {
                 .height(30);
             }
             .height(55)
+
+            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+            // 深色模式
+            Row() {
+              Text('显示私密音频')
+                .margin({ left: 18 })
+                .fontSize(15)
+                .fontColor(Color.Gray)
+                .fontWeight(480)
+                .layoutWeight(1)
+              Toggle({ type: ToggleType.Switch, isOn: this.isShowSimi })
+                .selectedColor($r('app.color.tab_item_bg'))
+                .switchPointColor(Color.White)
+                .margin({ right: 18 })
+                .onChange((checked: boolean) => {
+                  this.isShowSimi = checked;
+                  PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isShowSimi)
+                  ToastUtil.showToast('本设置重启才生效')
+                })
+                .width(50)
+                .height(30);
+            }
+            .height(55)
+
+            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+            // 深色模式
+            Row() {
+              Text('显示我的收藏')
+                .margin({ left: 18 })
+                .fontSize(15)
+                .fontColor(Color.Gray)
+                .fontWeight(480)
+                .layoutWeight(1)
+              Toggle({ type: ToggleType.Switch, isOn: this.isShowFAV })
+                .selectedColor($r('app.color.tab_item_bg'))
+                .switchPointColor(Color.White)
+                .margin({ right: 18 })
+                .onChange((checked: boolean) => {
+                  this.isShowFAV = checked;
+                  PreferencesUtil.put(SettingPage.IS_SHOW_FAV, this.isShowFAV)
+                  ToastUtil.showToast('本设置重启才生效')
+                })
+                .width(50)
+                .height(30);
+            }
+            .height(55)
+
+            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+            // 深色模式
+            Row() {
+              Text('显示最近播放')
+                .margin({ left: 18 })
+                .fontSize(15)
+                .fontColor(Color.Gray)
+                .fontWeight(480)
+                .layoutWeight(1)
+              Toggle({ type: ToggleType.Switch, isOn: this.isShowHistory })
+                .selectedColor($r('app.color.tab_item_bg'))
+                .switchPointColor(Color.White)
+                .margin({ right: 18 })
+                .onChange((checked: boolean) => {
+                  this.isShowHistory = checked;
+                  PreferencesUtil.put(SettingPage.IS_SHOW_HISTORY, this.isShowHistory)
+                  ToastUtil.showToast('本设置重启才生效')
+                })
+                .width(50)
+                .height(30);
+            }
+            .height(55)
           }
           .backgroundColor($r('app.color.settings_background_main'))
           .borderRadius(20)
@@ -366,8 +450,9 @@ export struct SettingPage {
       .height('100%')
       .width('100%')
       .margin({bottom:18})
+      .backgroundColor($r('app.color.settings_background'))
     }
-    .backgroundColor($r('app.color.settings_background'))
+
     .height('100%')
     .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
   }

+ 1 - 1
entry/src/main/ets/pages/VerifyPage.ets

@@ -226,7 +226,7 @@ export struct VerifyPage{
             this.verType = 2
           })
       }
-        .backgroundColor(Color.White)
+        .backgroundColor($r('app.color.bottom_control_background'))
         .margin({top:30,left:30,right:30})
         .borderRadius(20)
 

+ 52 - 31
entry/src/main/ets/view/LocalMusic.ets

@@ -165,6 +165,10 @@ export struct LocalMusic {
   @Consume @Watch('onModeChange') modeType: number; // 0首页,1媒体库,2艺术家,3专辑
   @State showSingleLyric: boolean = false
   @State sortType: number = 4 //默认排序方式
+  @State isShowSimi:boolean = false //是否显示私密音频
+  @State isShowFAV:boolean = true //是否显示我的收藏
+  @State isShowHistory:boolean = true //是否显示最近播放
+
   @State isDarkMode: boolean = false
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
@@ -313,7 +317,7 @@ export struct LocalMusic {
     .setLeftIconHeight(25)
     .setTitleName('首页')
     .setTitleFontSize(19)
-    .setTitleFontColor($r('app.color.text_color'))// 根据深色模式状态动态设置标题栏背景色
+    .setTitleFontColor(Color.White)
     .setTitleBarBackground($r('app.color.title_bar_bg'))
     .setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
     .setRightTitleBackground($r('app.color.title_bar_bg'))
@@ -358,6 +362,7 @@ export struct LocalMusic {
   // 组件生命周期
   aboutToAppear() {
     this.sortType = PreferencesUtil.getNumberSync(SettingPage.SORT_TYPE, 4)
+
     Utility.getAppName(getContext(this)).then((appName: string) => {
       this.appName = appName
     })
@@ -1912,7 +1917,7 @@ export struct LocalMusic {
       }
       .width('100%')
       .height('100%')
-      .backgroundColor($r('app.color.index_background'))
+      .backgroundColor($r('app.color.bottom_control_background'))
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
 
     }
@@ -2224,12 +2229,31 @@ export struct LocalMusic {
     }
     .height(58)
     .width('100%')
+    .visibility(this.isShowDir(item.name)?Visibility.Visible:Visibility.None)
     .opacity(this.opacityItem) // 绑定透明度
     .stateStyles({
       pressed: { opacity: 0.6 } // 按压反馈
     })
   }
 
+  isShowDir(dirName:string){
+    this.isShowSimi = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SIMI, false)
+    this.isShowFAV = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_FAV, true)
+    this.isShowHistory = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_HISTORY, true)
+    if(dirName ===undefined)
+      return true
+    if(dirName === LocalMusic.STR_LOCK_VIDEO){
+      return this.isShowSimi
+    }
+    if(dirName === LocalMusic.STR_FAC_VIDEO){
+      return this.isShowFAV
+    }
+    if(dirName === LocalMusic.STR_HISTORY_MUSIC){
+      return this.isShowHistory
+    }
+    return true
+  }
+
   @State opacityItem: number = 1; // 控制透明度的状态变量
 
   @Builder
@@ -2515,7 +2539,7 @@ export struct LocalMusic {
           duration: 666,
           curve: 'ease-in-out' // 可选动画曲线
         })
-        .backgroundColor(this.isClickedPLayAll ? $r('app.color.silvery') : $r('app.color.index_background'))
+        .backgroundColor(this.isClickedPLayAll ? $r('app.color.button_click') : Color.Transparent)
         .onTouch((event: TouchEvent) => {
           if (event.type === TouchType.Down) {
             this.isClickedPLayAll = true;
@@ -2862,8 +2886,7 @@ export struct LocalMusic {
 
       }, (item: VideoItem) => item.filePath)
     }
-    .backgroundColor($r('app.color.index_background'))
-    .divider({ strokeWidth: 1, color: this.isDarkMode? '333333':'#ffe9f0f0' })
+    // .divider({ strokeWidth: 1, color: this.isDarkMode? '#333333':'#ffe9f0f0' })
     .margin({ bottom: this.isPuraWP() ? 50 : 108 })
     .cachedCount(30)
     .borderRadius(20)
@@ -3155,7 +3178,7 @@ export struct LocalMusic {
       .height(this.bottomBarHeight)
       .justifyContent(FlexAlign.Center)
       .hitTestBehavior(HitTestMode.Transparent)
-      .backgroundColor($r('app.color.index_background'))
+      .backgroundColor($r('app.color.bottom_control_background'))
       .bindContentCover($$this.isShowPlay, this.MusicPlayBuilder(), {
         // modalTransition: ModalTransition.DEFAULT,
         transition: AnimationHelper.transitionInDown(666),
@@ -3695,7 +3718,7 @@ export struct LocalMusic {
         `剩余时间:${this.formatTime(this.remainingSeconds)}` :
         "定时关闭未开启")
         .fontSize(17)
-        .fontColor($r('app.color.title_bar_bg'))
+        .fontColor($r('app.color.text_color'))
         .margin({ top: 2 });
 
       Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
@@ -3720,7 +3743,7 @@ export struct LocalMusic {
           }
           .width('100%')
           .padding(10)
-          .backgroundColor(minutes === this.selectedMinutes ? 0xf0f8ff : 0xffffff) // 选中背景高亮
+          .backgroundColor(minutes === this.selectedMinutes ?$r('app.color.timeColor_bg') :$r('app.color.bottom_control_background')) // 选中背景高亮
           .borderRadius(12)
           .margin({ bottom: 6 })
           .onClick(() => this.handleSelect(minutes)); // 确保点击触发选择
@@ -4904,7 +4927,7 @@ export struct LocalMusic {
           Image($r('app.media.menu'))
             .width(24)
             .bindSheet($$this.isShowMoreView, this.PlayMoreSheet(), {
-              height: this.isCoverOpacity() ? '95%' : '85%',
+              height: this.isCoverOpacity() ? '95%' : '95%',
               dragBar: true,
               showClose: true,
               blurStyle: BlurStyle.Thin,
@@ -5285,7 +5308,7 @@ export struct LocalMusic {
         Text(`歌词居中:`)
           .fontSize(14)
           .fontColor(Color.White)
-
+          .margin({ right: 8 })
         Row() {
           ForEach(['居中', '居左'], (size: string, index: number) => {
             Button(size)
@@ -5304,35 +5327,33 @@ export struct LocalMusic {
               .margin({ left: 8, right: 8 })
           })
         }
+        .layoutWeight(1)
+        Blank()
 
       }
-      .margin({ top: 10, bottom: 10 })
+      .justifyContent(FlexAlign.Start)
+      .margin({ top:10,bottom:10,right:20,left:35})
 
       Row() {
         Text(`歌词颜色:`)
           .fontSize(14)
           .fontColor(Color.White)
 
-        Row({ space: 10 }) {
+        Row({space: 10}) {
           HSBColorPicker({
-            color: this.currentLyricColor,
+            color: '#FFFFFF',
             radius: 8,
             layout: HSBColorPickerLayout.COLUMN,
-            onChange: (value: string) => this.changeLyricColor(value)
+            onChange:(value: string) =>this.changeLyricColor(value)
           })
             .height(88)
             .layoutWeight(1)
-            .padding({ left: 10 })
+            .padding({left:15,right:35})
         }
-        .margin({ right: 30 })
+
       }
-      .width('77%')
-      .margin({
-        top: 10,
-        bottom: 10,
-        right: 35,
-        left: 20
-      })
+      .width('76%')
+      .margin({ top:10,bottom:10,right:45,left:20})
 
       Row() {
         Text(`歌词字号:`)
@@ -5350,13 +5371,13 @@ export struct LocalMusic {
           .blockColor(Color.Red)
           .trackColor($r('app.color.speed_text_color'))
           .selectedColor(Color.White)
-          .trackThickness(5)
+          .trackThickness(6)
           .onChange((value: number) => {
             ;
             this.setLyricTextSize(value)
 
           })
-          .width('80%')
+          .width('76%')
 
       }
       .margin({
@@ -5382,13 +5403,13 @@ export struct LocalMusic {
           .blockColor(Color.Red)
           .trackColor($r('app.color.speed_text_color'))
           .selectedColor(Color.White)
-          .trackThickness(5)
+          .trackThickness(6)
           .onChange((value: number) => {
             ;
             this.setHighLyricTextSize(value)
 
           })
-          .width('80%')
+          .width('76%')
 
       }
       .margin({
@@ -5413,13 +5434,13 @@ export struct LocalMusic {
           .blockColor(Color.Red)
           .trackColor($r('app.color.speed_text_color'))
           .selectedColor(Color.White)
-          .trackThickness(5)
+          .trackThickness(6)
           .onChange((value: number) => {
             ;
             this.setLyricLineSpace(value)
 
           })
-          .width('80%')
+          .width('76%')
 
 
       }
@@ -5444,13 +5465,13 @@ export struct LocalMusic {
           .blockColor(Color.Red)
           .trackColor($r('app.color.speed_text_color'))
           .selectedColor(Color.White)
-          .trackThickness(5)
+          .trackThickness(6)
           .onChange((value: number) => {
             ;
             this.setBlurDegree(value)
 
           })
-          .width('80%')
+          .width('76%')
 
 
       }

+ 1 - 4
entry/src/main/ets/view/Verify.ets

@@ -134,7 +134,6 @@ export struct Verify{
               .height(22)
               .margin({ left: 20, right: 20 })
               .align(Alignment.Center)
-              .colorBlend(Color.Red)
               .checked(this.isMima)
               .onChange((isChecked: boolean) => {
                 if (isChecked) {
@@ -168,7 +167,6 @@ export struct Verify{
             Radio({ value: 'Radio2', group: 'radioGroup' })
               .width(22)
               .height(22)
-              .colorBlend(Color.Red)
               .margin({ left: 20, right: 20 })
               .align(Alignment.Center)
               .checked(this.isFingerprint)
@@ -203,7 +201,6 @@ export struct Verify{
             Radio({ value: 'Radio3', group: 'radioGroup' })
               .width(22)
               .height(22)
-              .colorBlend(Color.Red)
               .margin({ left: 20, right: 20 })
               .align(Alignment.Center)
               .checked(this.isFace)
@@ -225,7 +222,7 @@ export struct Verify{
             this.verType = 2
           })
       }
-        .backgroundColor(Color.White)
+        .backgroundColor($r('app.color.bottom_control_background'))
         .margin({top:30,left:30,right:30})
         .borderRadius(20)
 

+ 13 - 0
entry/src/main/resources/base/element/color.json

@@ -138,6 +138,19 @@
     {
       "name": "settings_background_main",
       "value": "#ffffff"
+    },
+    {
+      "name": "bottom_control_background",
+      "value": "#FFFFFF"
+    },
+    {
+      "name": "button_click",
+      "value": "#D3D3D3"
+    },
+
+    {
+      "name": "timeColor_bg",
+      "value": "#f0f8ff"
     }
   ]
 }

+ 14 - 1
entry/src/main/resources/dark/element/color.json

@@ -30,7 +30,7 @@
     },
     {
       "name": "title_bar_bg",
-      "value": "#00000000"
+      "value": "#000000"
     },
     {
       "name": "tab_item_bg",
@@ -155,6 +155,19 @@
     {
       "name": "settings_background_main",
       "value": "#000000"
+    },
+    {
+      "name": "bottom_control_background",
+      "value": "#000000"
+    },
+    {
+      "name": "button_click",
+      "value": "#1E1E1E"
+    },
+
+    {
+      "name": "timeColor_bg",
+      "value": "#FF373737"
     }
   ]
 }