Преглед изворни кода

优化Navidrome的点击 艺术家或者专辑的时候 不需要切换tab 2

onecold пре 7 месеци
родитељ
комит
7bc736116a
2 измењених фајлова са 15 додато и 29 уклоњено
  1. 3 13
      entry/src/main/ets/view/LocalMusic.ets
  2. 12 16
      entry/src/main/ets/view/NavidromePage.ets

+ 3 - 13
entry/src/main/ets/view/LocalMusic.ets

@@ -2339,7 +2339,7 @@ export struct LocalMusic {
 
 
 
 
     for (let i = 0; i < this.fileList.length; i++) {
     for (let i = 0; i < this.fileList.length; i++) {
-      console.info(`The name of file: ${this.fileList[i]}`);
+      // console.info(`The name of file: ${this.fileList[i]}`);
       let path = curPath + '/' + this.fileList[i]
       let path = curPath + '/' + this.fileList[i]
       if (FileUtil.isDirectory(path)) {
       if (FileUtil.isDirectory(path)) {
         let item: VideoItem =
         let item: VideoItem =
@@ -6624,18 +6624,6 @@ export struct LocalMusic {
             }
             }
           }
           }
 
 
-          .shadow(this.scaleItem === index ? {
-            radius: 70,
-            color: '#15000000',
-            offsetX: 0,
-            offsetY: 0
-          } :
-            {
-              radius: 0,
-              color: '#15000000',
-              offsetX: 0,
-              offsetY: 0
-            })
           .animation({ curve: Curve.Sharp, duration: 300 })
           .animation({ curve: Curve.Sharp, duration: 300 })
 
 
         }
         }
@@ -10272,6 +10260,8 @@ export struct LocalMusic {
         Image(this.cover)
         Image(this.cover)
           .height(58)
           .height(58)
           .width(58)
           .width(58)
+          .clip(true)
+          .sourceSize({width:38, height:38})
           .alt($r('app.media.alt'))
           .alt($r('app.media.alt'))
           .borderRadius(8)
           .borderRadius(8)
           .clickEffect({ level: ClickEffectLevel.HEAVY })
           .clickEffect({ level: ClickEffectLevel.HEAVY })

+ 12 - 16
entry/src/main/ets/view/NavidromePage.ets

@@ -153,7 +153,13 @@ export struct NavidromePage {
   onTabSelectedIndexesChanged() {
   onTabSelectedIndexesChanged() {
     this.selectedTab = this.tabSelectedIndexes[0];
     this.selectedTab = this.tabSelectedIndexes[0];
     console.info('heanup', `Selected tab: ${this.tabs[this.selectedTab]}`);
     console.info('heanup', `Selected tab: ${this.tabs[this.selectedTab]}`);
-    
+
+    // 如果在详情视图模式下切换标签页,退出详情视图并清除筛选
+    if (this.isDetailView) {
+      this.isDetailView = false;
+      this.clearFilter();
+    }
+
     // 从艺术家或专辑切换回全部时,清除筛选状态
     // 从艺术家或专辑切换回全部时,清除筛选状态
     if (this.selectedTab === 0 && this.filterType !== NavFilterType.None) {
     if (this.selectedTab === 0 && this.filterType !== NavFilterType.None) {
       // 不清除筛选,保持筛选状态
       // 不清除筛选,保持筛选状态
@@ -1134,6 +1140,10 @@ export struct NavidromePage {
           .fillColor(song.pixelMapPath ? undefined : this.themeColor)
           .fillColor(song.pixelMapPath ? undefined : this.themeColor)
           .objectFit(ImageFit.Cover)
           .objectFit(ImageFit.Cover)
           .margin({ left: 20 })
           .margin({ left: 20 })
+          .animation({
+            duration: 500,
+            curve: Curve.Friction  // 可选动画曲线
+          })
           .shadow({
           .shadow({
             radius: StrUtil.isEmpty(song.pixelMapPath) ?6:14,
             radius: StrUtil.isEmpty(song.pixelMapPath) ?6:14,
             type: ShadowType.BLUR,
             type: ShadowType.BLUR,
@@ -1527,21 +1537,7 @@ export struct NavidromePage {
       .padding({top:this.topSafeHeight+98})
       .padding({top:this.topSafeHeight+98})
       .justifyContent(FlexAlign.Center)
       .justifyContent(FlexAlign.Center)
     } else {
     } else {
-      if (this.selectedTab === 0 && this.filterType !== NavFilterType.None) {
-        Row({ space: 8 }) {
-          Text(`筛选:${this.filterLabel}`)
-            .fontSize(13)
-            .fontColor(this.themeColor)
-            .layoutWeight(1)
-          Button('返回')
-            .type(ButtonType.Capsule)
-            .backgroundColor(this.themeColor)
-            .fontSize(11)
-            .onClick(() => this.clearFilter())
-        }
-        .width('90%')
-        .padding({ left: 16, right: 16, top: this.topSafeHeight+118, bottom: 2 })
-      }
+
 
 
       if (this.isSearchMode && this.selectedTab === 0 && this.searchText.length > 0 && this.isSearchLoading) {
       if (this.isSearchMode && this.selectedTab === 0 && this.searchText.length > 0 && this.isSearchLoading) {
         Column() {
         Column() {