Эх сурвалжийг харах

增加开关控制二级菜单新风格

onecold 1 жил өмнө
parent
commit
75828a98d6

+ 31 - 1
entry/src/main/ets/pages/SettingPage.ets

@@ -48,6 +48,7 @@ export struct SettingPage {
   static readonly IS_SHOW_SLLYRIC: string = 'IS_SHOW_SLLYRIC';
   static readonly IS_CIRCLE_BTN: string = 'isCircleBtn';
   static readonly IS_COVER_TOP: string = 'IS_COVER_TOP';
+  static readonly IS_SHOW_HEADER: string = 'IS_SHOW_HEADER';
   static readonly IS_COVER_TOP_BIG: string = 'IS_COVER_TOP_BIG';
   public static THEME_COLOR_KEY: string = 'THEME_COLOR';
   public static TWO_FINGER_TYPE: string = 'twoFingerType';
@@ -89,6 +90,7 @@ export struct SettingPage {
   @State isShowHistory: boolean = true //是否显示最近播放
   @State isShowPlayPageBack: boolean = false //是否显示播放页返回键
   @State isShowSingleLineLyric: boolean = false //是否显示播放页返回键
+  @State isShowHeader: boolean = true
   @State isCustomizeBg: boolean = false //自定义背景界面
   @State isCustomizeBgSheet: boolean = false //自定义背景界面
   @State isShowTitleBar: boolean = true //是否显示分类导航条
@@ -219,6 +221,8 @@ export struct SettingPage {
     this.isShowSingleLineLyric = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SLLYRIC, false)
     this.isCoverTopBig = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP_BIG, false)
     this.longPressSpeed = PreferencesUtil.getNumberSync(SettingPage.LONG_PRESS_SPEED, 3)
+    this.isShowHeader = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_HEADER, true)
+
     // 只用 themeMode 控制主题
     this.themeMode = PreferencesUtil.getNumberSync(SettingPage.THEME_MODE, 0)
     this.applyThemeMode(this.themeMode)
@@ -1179,7 +1183,7 @@ export struct SettingPage {
       .clickEffect({ level: ClickEffectLevel.HEAVY })
 
       Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-      // 播放页返回键
+      // 播放页单行歌词
       Row() {
         Text('播放页单行歌词')
           .margin({ left: 18 })
@@ -1203,6 +1207,32 @@ export struct SettingPage {
       .height(55)
       .clickEffect({ level: ClickEffectLevel.HEAVY })
 
+      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.isShowHeader })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+          .onChange((checked: boolean) => {
+            this.isShowHeader = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_HEADER, this.isShowHeader)
+            this.sendChangeEvent()
+          })
+          .width(50)
+          .height(30);
+      }
+      .height(55)
+      .clickEffect({ level: ClickEffectLevel.HEAVY })
+
       Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
       // 播放页返回键
       Row() {

+ 5 - 1
entry/src/main/ets/view/LocalMusic.ets

@@ -176,6 +176,7 @@ export struct LocalMusic {
   @State isSameTimePlay: boolean = false //是否和其他app同时播放
   @State isStartAutoPlay: boolean = false //启动后自动播放
   @State isShowPlayPageBack: boolean = false //是否显示播放页返回键
+  @State isShowHeader: boolean = true
   @State isShowSingleLineLyric: boolean = false //是否显示播放页返回键
   @State isMemoryLastPlay: boolean = false //是否启用应用退出记忆最后一首的播放进度
   @State isCoverTopBig: boolean = false//顶部大封面部分手机显示会和播放控制页重叠
@@ -594,6 +595,7 @@ export struct LocalMusic {
     this.isCoverTopBig = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP_BIG, false)
     this.isShowSingleLineLyric = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SLLYRIC, false)
     this.longPressSpeed = PreferencesUtil.getNumberSync(SettingPage.LONG_PRESS_SPEED, 3)
+    this.isShowHeader = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_HEADER, true)
     if (this.isSavePlayMode) {
       this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
     }
@@ -2686,6 +2688,8 @@ export struct LocalMusic {
   @State currentTitleCover:string|ResourceStr = ''//点击歌单,艺术家,专辑进去后的封面
 
   isShowCoverHeader(){
+    if(!this.isShowHeader)
+      return false
     if(this.modeType==0){
       if(this.isHistory||this.isFavMusic){
         return true
@@ -3350,7 +3354,7 @@ export struct LocalMusic {
 
       }, (item: VideoItem) => item.filePath)
     }
-    .width('100%')
+    .width(this.isShowHeader?'100%':'94%')
     .height('100%')
     .editMode(true)
     .transition(TransitionEffect.move(TransitionEdge.BOTTOM)