Prechádzať zdrojové kódy

增加详情的音轨数显示
增加显示 分类导航条和播放全部条的开关

onecold 1 rok pred
rodič
commit
a079be0115

+ 2 - 2
build-profile.json5

@@ -30,11 +30,11 @@
         "material": {
           "certpath": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.cer",
           "keyAlias": "debugKey",
-          "keyPassword": "0000001BA5BA8BCF0397D117A6121CDBD529A90551EA8AEFCA65626E2F75F588C790AB168F039C8B72A189",
+          "keyPassword": "0000001A543624345010BDB78B9F87C42612E438AA1525C7BC6DFC8CD449DEDFD44E55D9C27D91688DE4",
           "profile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p7b",
           "signAlg": "SHA256withECDSA",
           "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
-          "storePassword": "0000001B28EBE7DDAD6E1F57270962ACCF1B34838A418C7AFCBE02A07F06F24182D53A18CADBF33380DB17"
+          "storePassword": "0000001AF9FE996380EE4AA8DB48D88C53A8F9A623B0B48F806156F79A5F7FCCCC1E07A9677CC201F4C5"
         }
       }
     ]

+ 287 - 187
entry/src/main/ets/pages/SettingPage.ets

@@ -46,6 +46,8 @@ export struct SettingPage {
   static readonly IS_SAMETIME_PLAY: string = 'isSameTimePlay';
   static readonly CUSTOMIZE_BG_BLUR: string = 'customize_bg_blur';
   static readonly BG_BRIGHTNESS: string = 'bg_brightness';
+  static readonly IS_SHOW_ALLBAR: string = 'IS_SHOW_ALLBAR';
+  static readonly IS_SHOW_TITLTBAR: string = 'IS_SHOW_TITLTBAR';
   public static THEME_COLOR_KEY: string = 'THEME_COLOR';
   public static THEME_COLOR_LIST: Array<ThemeColorItem> = [
     { name: '经典蓝', color: '#0A59F7' },
@@ -84,6 +86,8 @@ export struct SettingPage {
   @State isShowHistory: boolean = true //是否显示最近播放
   @State isCustomizeBg: boolean = false //自定义背景界面
   @State isCustomizeBgSheet: boolean = false //自定义背景界面
+  @State isShowTitleBar: boolean = true //是否显示分类导航条
+  @State isShowAllBar: boolean = true //是否显示播放全部条
   @State blurValue: number = 0 //背景模糊
   @State bgBrightness: number = 0 //背景亮度
   @State isGridMusic: boolean = false //是否网格布局
@@ -193,6 +197,9 @@ export struct SettingPage {
     this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
     this.isStartAutoPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_START_AUTO_PLAY, false)
     this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
+
+    this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
+    this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
     // 只用 themeMode 控制主题
     this.themeMode = PreferencesUtil.getNumberSync(SettingPage.THEME_MODE, 0)
     this.applyThemeMode(this.themeMode)
@@ -633,76 +640,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 })
-                .fontSize(15)
-                .fontColor(Color.Gray)
-                .fontWeight(480)
-                .layoutWeight(1)
-              Toggle({ type: ToggleType.Switch, isOn: this.isShowSimi })
-                .selectedColor(this.themeColor)
-                .switchPointColor(Color.White)
-                .margin({ right: 18 })
-                .onChange((checked: boolean) => {
-                  this.isShowSimi = checked;
-                  PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isShowSimi)
-                  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() {
-              Text('显示我的收藏')
-                .margin({ left: 18 })
-                .fontSize(15)
-                .fontColor(Color.Gray)
-                .fontWeight(480)
-                .layoutWeight(1)
-              Toggle({ type: ToggleType.Switch, isOn: this.isShowFAV })
-                .selectedColor(this.themeColor)
-                .switchPointColor(Color.White)
-                .margin({ right: 18 })
-                .onChange((checked: boolean) => {
-                  this.isShowFAV = checked;
-                  PreferencesUtil.put(SettingPage.IS_SHOW_FAV, this.isShowFAV)
-                  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() {
-              Text('显示最近播放')
-                .margin({ left: 18 })
-                .fontSize(15)
-                .fontColor(Color.Gray)
-                .fontWeight(480)
-                .layoutWeight(1)
-              Toggle({ type: ToggleType.Switch, isOn: this.isShowHistory })
-                .selectedColor(this.themeColor)
-                .switchPointColor(Color.White)
-                .margin({ right: 18 })
-                .onChange((checked: boolean) => {
-                  this.isShowHistory = checked;
-                  PreferencesUtil.put(SettingPage.IS_SHOW_HISTORY, this.isShowHistory)
-                  this.sendChangeEvent()
-                })
-                .width(50)
-                .height(30);
-            }
-            .height(55)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
           }
           .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
             .animation({ duration: 500, curve: Curve.Ease,delay:200 }))
@@ -914,125 +852,11 @@ export struct SettingPage {
           .padding(0)
 
           // API设置分组
-          Column() {
-            Row() {
-              Text('API设置')
-                .margin({ left: 18, right: 20 })
-                .fontSize(16)
-                .fontColor(Color.Gray)
-                .fontWeight(480)
-                .layoutWeight(1)
-            }
-            .height(48)
-
-            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-            // 歌词API
-            Button({ type: ButtonType.Normal, stateEffect: true }) {
-              Row() {
-                Text('歌词:')
-                  .margin({ left: 18, right: 6 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                Text(this.lyricApiUrl)
-                  .margin({ right: 10 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                  .layoutWeight(1)
-                Image(this.isDarkMode ? $r('app.media.rename2') : $r('app.media.rename'))
-                  .width(20)
-                  .height(20)
-                  .margin({ right: 18 })
-
-              }
-            }
-            .clickEffect({level:ClickEffectLevel.HEAVY})
-            .backgroundColor(Color.Transparent)
-            .onClick(() => {
-              this.apiDialogType = 'lyric'
-              this.tempApiUrl = this.lyricApiUrl
-              this.apiDialogController.open()
-            })
-            .height(55)
-            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-            // 封面API
-            Button({ type: ButtonType.Normal, stateEffect: true }) {
-              Row() {
-                Text('封面:')
-                  .margin({ left: 18, right: 6 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                Text(this.coverApiUrl)
-                  .margin({ right: 10 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                  .layoutWeight(1)
-                Image(this.isDarkMode ? $r('app.media.rename2') : $r('app.media.rename'))
-                  .width(20)
-                  .height(20)
-                  .margin({ right: 18 })
-
-              }
-            }
-            .clickEffect({level:ClickEffectLevel.HEAVY})
-            .backgroundColor(Color.Transparent)
-            .onClick(() => {
-              this.apiDialogType = 'cover'
-              this.tempApiUrl = this.coverApiUrl
-              this.apiDialogController.open()
-            })
-            .height(55)
-
-          }
-          .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
-            .animation({ duration: 600, curve: Curve.Ease ,delay:600}))
-          .backgroundColor($r('app.color.settings_background_main'))
-          .borderRadius(20)
-          .margin({
-            left: 0,
-            right: 0,
-            top: 10,
-            bottom: 20
-          })
-          .padding(0)
-
-
+          this.apiBuilder()
           //设置教程
-          Button({ type: ButtonType.Capsule, stateEffect: true }) {
-            Column() {
-              Row() {
-                Text('设置教程:')
-                  .margin({ left: 18 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                  .fontWeight(480)
-                Text('点击进Q群讨论')
-                  .margin({ right: 10 })
-                  .fontSize(15)
-                  .fontColor(Color.Gray)
-                  .layoutWeight(1)
-                Blank()
-                // 右侧箭头
-                Image($r('app.media.arrow_right'))
-                  .width(22)
-                  .height(22)
-                  .margin({ left: 20, right: 20 })
-                  .align(Alignment.Center)
-              }
-              .height(55)
-
-            }
-          }
-          .clickEffect({level:ClickEffectLevel.HEAVY})
-          .onClick(() => {
-            const qqUrl =
-              `mqqapi://card/show_pslcard?src_type=internal&version=1&uin=${CommonConstants.QQ_GROUP}&card_type=group&source=external`;
-            let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
-            context.openLink(qqUrl, {})
-          })
-          .backgroundColor($r('app.color.settings_background_main'))
-          .borderRadius(15)
-          .margin({ top: 0, bottom: 20 })
-          .padding(0)
+          this.jcBuilder()
+          //显示与隐藏设置
+          this.xsBuilder()
 
 
           //空白
@@ -1060,6 +884,282 @@ export struct SettingPage {
     .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
   }
 
+  @Builder
+  xsBuilder() {
+    // 显示和隐藏分组
+    Column() {
+      Row() {
+        Text('显示隐藏')
+          .margin({ left: 18, right: 20 })
+          .fontSize(16)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+      }
+      .height(48)
+
+      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.isShowTitleBar })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowTitleBar = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_TITLTBAR, this.isShowTitleBar)
+            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() {
+        Text('显示播放全部条')
+          .margin({ left: 18 })
+          .fontSize(15)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+        Toggle({ type: ToggleType.Switch, isOn: this.isShowAllBar })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowAllBar = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_ALLBAR, this.isShowAllBar)
+            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() {
+        Text('显示私密音频')
+          .margin({ left: 18 })
+          .fontSize(15)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+        Toggle({ type: ToggleType.Switch, isOn: this.isShowSimi })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowSimi = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isShowSimi)
+            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() {
+        Text('显示我的收藏')
+          .margin({ left: 18 })
+          .fontSize(15)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+        Toggle({ type: ToggleType.Switch, isOn: this.isShowFAV })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowFAV = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_FAV, this.isShowFAV)
+            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() {
+        Text('显示最近播放')
+          .margin({ left: 18 })
+          .fontSize(15)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+        Toggle({ type: ToggleType.Switch, isOn: this.isShowHistory })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowHistory = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_HISTORY, this.isShowHistory)
+            this.sendChangeEvent()
+          })
+          .width(50)
+          .height(30);
+      }
+      .height(55)
+      .clickEffect({level:ClickEffectLevel.HEAVY})
+
+    }
+    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+      .animation({ duration: 500, curve: Curve.Ease ,delay:600}))
+    .backgroundColor($r('app.color.settings_background_main'))
+    .borderRadius(20)
+    .margin({
+      left: 0,
+      right: 0,
+      top: 10,
+      bottom: 20
+    })
+    .padding(0)
+  }
+
+  @Builder
+  jcBuilder() {
+    //设置教程
+    Button({ type: ButtonType.Capsule, stateEffect: true }) {
+      Column() {
+        Row() {
+          Text('设置教程:')
+            .margin({ left: 18 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+            .fontWeight(480)
+          Text('点击进Q群讨论')
+            .margin({ right: 10 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+            .layoutWeight(1)
+          Blank()
+          // 右侧箭头
+          Image($r('app.media.arrow_right'))
+            .width(22)
+            .height(22)
+            .margin({ left: 20, right: 20 })
+            .align(Alignment.Center)
+        }
+        .height(55)
+
+      }
+    }
+    .clickEffect({ level: ClickEffectLevel.HEAVY })
+    .onClick(() => {
+      const qqUrl =
+        `mqqapi://card/show_pslcard?src_type=internal&version=1&uin=${CommonConstants.QQ_GROUP}&card_type=group&source=external`
+      let context = this.getUIContext().getHostContext() as common.UIAbilityContext
+      context.openLink(qqUrl, {})
+    })
+    .backgroundColor($r('app.color.settings_background_main'))
+    .borderRadius(15)
+    .margin({ top: 0, bottom: 20 })
+    .padding(0)
+  }
+
+  @Builder
+  apiBuilder() {
+    // API设置分组
+    Column() {
+      Row() {
+        Text('API设置')
+          .margin({ left: 18, right: 20 })
+          .fontSize(16)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+      }
+      .height(48)
+
+      Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+      // 歌词API
+      Button({ type: ButtonType.Normal, stateEffect: true }) {
+        Row() {
+          Text('歌词:')
+            .margin({ left: 18, right: 6 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+          Text(this.lyricApiUrl)
+            .margin({ right: 10 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+            .layoutWeight(1)
+          Image(this.isDarkMode ? $r('app.media.rename2') : $r('app.media.rename'))
+            .width(20)
+            .height(20)
+            .margin({ right: 18 })
+
+        }
+      }
+      .clickEffect({ level: ClickEffectLevel.HEAVY })
+      .backgroundColor(Color.Transparent)
+      .onClick(() => {
+        this.apiDialogType = 'lyric'
+        this.tempApiUrl = this.lyricApiUrl
+        this.apiDialogController.open()
+      })
+      .height(55)
+
+      Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+      // 封面API
+      Button({ type: ButtonType.Normal, stateEffect: true }) {
+        Row() {
+          Text('封面:')
+            .margin({ left: 18, right: 6 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+          Text(this.coverApiUrl)
+            .margin({ right: 10 })
+            .fontSize(15)
+            .fontColor(Color.Gray)
+            .layoutWeight(1)
+          Image(this.isDarkMode ? $r('app.media.rename2') : $r('app.media.rename'))
+            .width(20)
+            .height(20)
+            .margin({ right: 18 })
+
+        }
+      }
+      .clickEffect({ level: ClickEffectLevel.HEAVY })
+      .backgroundColor(Color.Transparent)
+      .onClick(() => {
+        this.apiDialogType = 'cover'
+        this.tempApiUrl = this.coverApiUrl
+        this.apiDialogController.open()
+      })
+      .height(55)
+
+    }
+    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+      .animation({ duration: 500, curve: Curve.Ease ,delay:600}))
+    .backgroundColor($r('app.color.settings_background_main'))
+    .borderRadius(20)
+    .margin({
+      left: 0,
+      right: 0,
+      top: 10,
+      bottom: 20
+    })
+    .padding(0)
+  }
+
   //发送广播通知更新UI
   sendChangeEvent() {
     const eventData: emitter.EventData = {};

+ 1 - 0
entry/src/main/ets/pages/UserCenter.ets

@@ -150,6 +150,7 @@ export struct UserCenter {
         // 微信登录成功回调
         const authResp = resp as wxopensdk.SendAuthResp; // 转换为授权响应类型,以便访问code
         this.getUserInfoByCode(resp?.['code'])
+        DialogHelper.closeDialog('loginDialog');
         ToastUtil.showToast('登录成功!');
       } else if (resp.type === wxopensdk.Command.kCommandPay) {
         // 微信支付成功回调

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

@@ -171,6 +171,8 @@ export struct LocalMusic {
   @State sortType: number = 4 //默认排序方式
   @State isShowSimi:boolean = false //是否显示私密音频
   @State isShowFAV:boolean = true //是否显示我的收藏
+  @State isShowTitleBar: boolean = true //是否显示分类导航条
+  @State isShowAllBar: boolean = true //是否显示播放全部条
   @State isShowHistory:boolean = true //是否显示最近播放
   @State isCustomizeBg: boolean = false //自定义背景界面
   @State isGridMusic: boolean = false //是否网格布局
@@ -536,6 +538,8 @@ export struct LocalMusic {
     this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
     this.isStartAutoPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_START_AUTO_PLAY, false)
     this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
+    this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
+    this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
     if (this.isSavePlayMode) {
       this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
     }
@@ -2532,7 +2536,7 @@ export struct LocalMusic {
         .opacity(this.barOpacity)
         .visibility(this.isCustomizeBg?Visibility.Hidden:Visibility.Visible)
     }
-
+    .visibility(this.isShowTitleBar?Visibility.Visible:Visibility.None)
   }
 
   @Builder
@@ -2815,6 +2819,7 @@ export struct LocalMusic {
     }
     .height(this.topBarHeight)
     .opacity(this.barOpacity)
+    .visibility(this.isShowAllBar?Visibility.Visible:Visibility.None)
 
   }
 
@@ -4301,6 +4306,21 @@ export struct LocalMusic {
         .margin({ top: 10, bottom: 10 })
         .justifyContent(FlexAlign.Start)
 
+        Row() {
+          Text('音轨数:')
+            .fontSize(14)
+            .fontColor(Color.White)
+            .margin({ left: 22 })
+          Text(this.currentSong.trackCount)
+            .fontSize(14)
+            .margin({ left: 10 })
+            .fontColor(Color.White)
+            .layoutWeight(1)
+        }
+        .width('100%')
+        .margin({ top: 10, bottom: 10 })
+        .justifyContent(FlexAlign.Start)
+
         Row() {
           Text('格式:')
             .fontSize(14)