Explorar o código

webdav的封面加载问题
NewIndex的播放条点击发光

onecold hai 4 meses
pai
achega
bcc7ce9ab7

+ 39 - 40
entry/src/main/ets/pages/NewIndex.ets

@@ -1374,32 +1374,53 @@ struct NewIndex {
     .alignItems(VerticalAlign.Center)
     .alignItems(VerticalAlign.Center)
   }
   }
 
 
+  // 迷你播放条与 HiCar 模式复用同一个封面按钮,统一点击反馈与发光效果。
   @Builder
   @Builder
-  playConLeft() {
-    Row() {
-      Stack({ alignContent: Alignment.Center }) {
-        Image( StrUtil.isNotEmpty(this.currentSong?.pixelMapPath)?
-          this.currentSong?.pixelMapPath:$r('app.media.alt'))
-          .width(48)
-          .height(48)
-          .objectFit(ImageFit.Contain)
-          .alt( $r('app.media.alt'))
-          .fillColor(this.themeColor)
-          .borderRadius(8)
-          .shadow({
-            radius: 15,
-            type: ShadowType.BLUR,
-            color: 'on_primary'
-          })
+  private buildMiniPlayerCoverContent() {
+    Stack({ alignContent: Alignment.Center }) {
+      Image(StrUtil.isNotEmpty(this.currentSong?.pixelMapPath) ?
+        this.currentSong?.pixelMapPath : $r('app.media.alt'))
+        .width(48)
+        .height(48)
+        .objectFit(ImageFit.Contain)
+        .alt($r('app.media.alt'))
+        .fillColor(this.themeColor)
+        .borderRadius(8)
+        .shadow({
+          radius: 15,
+          type: ShadowType.BLUR,
+          color: 'on_primary'
+        })
+    }
+    .width(48)
+    .height(48)
+  }
+
+  @Builder
+  private miniPlayerCoverButton() {
+    PointLightContentButton({
+      pointColor: this.themeColor,
+      buttonRadius: 10,
+      pointLightHeight: 88,
+      pressScale: 0.92,
+      useShadow: false,
+      builder: () => {
+        this.buildMiniPlayerCoverContent()
       }
       }
+    })
       .width(48)
       .width(48)
       .height(48)
       .height(48)
       .margin({ left: 5 })
       .margin({ left: 5 })
       .zIndex(3)
       .zIndex(3)
-      .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.9 })
       .onClick((): void => {
       .onClick((): void => {
         this.collapseMiniPlayerToOrb()
         this.collapseMiniPlayerToOrb()
       })
       })
+  }
+
+  @Builder
+  playConLeft() {
+    Row() {
+      this.miniPlayerCoverButton()
 
 
       Column() {
       Column() {
         Text(this.currentSong?.name)
         Text(this.currentSong?.name)
@@ -1437,29 +1458,7 @@ struct NewIndex {
 
 
   @Builder
   @Builder
   private hiCarCoverControl() {
   private hiCarCoverControl() {
-    Stack({ alignContent: Alignment.Center }) {
-      Image(StrUtil.isNotEmpty(this.currentSong?.pixelMapPath)?
-        this.currentSong?.pixelMapPath:$r('app.media.alt'))
-        .width(48)
-        .height(48)
-        .objectFit(ImageFit.Contain)
-        .alt($r('app.media.alt'))
-        .fillColor(this.themeColor)
-        .borderRadius(8)
-        .shadow({
-          radius: 15,
-          type: ShadowType.BLUR,
-          color: 'on_primary'
-        })
-    }
-    .width(48)
-    .height(48)
-    .margin({ left: 5 })
-    .zIndex(3)
-    .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.9 })
-    .onClick((): void => {
-      this.collapseMiniPlayerToOrb()
-    })
+    this.miniPlayerCoverButton()
   }
   }
 
 
   @Builder
   @Builder

+ 2 - 0
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -550,6 +550,8 @@ export struct WebDavMainPage {
     if (dataIndex >= 0) {
     if (dataIndex >= 0) {
       this.dataSource.notifyDataChange(dataIndex);
       this.dataSource.notifyDataChange(dataIndex);
     }
     }
+    // 旧版本这里会额外刷新列表 key,ArkUI 长列表在异步封面回填时更稳定。
+    this.listRefreshKey += 1;
   }
   }
 
 
   private async prepareRemoteThumbSource(item: VideoItem): Promise<RemoteThumbSource> {
   private async prepareRemoteThumbSource(item: VideoItem): Promise<RemoteThumbSource> {

+ 3 - 0
entry/src/main/ets/view/FindView.ets

@@ -505,6 +505,7 @@ export struct FindView {
         targets.push(group.songs[0])
         targets.push(group.songs[0])
       }
       }
     }
     }
+    // 只修当前发现页真正可见的一小批远程歌曲,避免初次进入时后台任务过重。
     return this.filterUniqueSongs(targets).slice(0, REMOTE_VISIBLE_COVER_RESOLVE_LIMIT)
     return this.filterUniqueSongs(targets).slice(0, REMOTE_VISIBLE_COVER_RESOLVE_LIMIT)
   }
   }
 
 
@@ -620,6 +621,7 @@ export struct FindView {
         return undefined
         return undefined
       }
       }
       const activeAccount = this.remoteDriveManager.getActivatedWebDavAccount() || accounts[0]
       const activeAccount = this.remoteDriveManager.getActivatedWebDavAccount() || accounts[0]
+      // 云端漫游优先挑“当前发现页已有歌曲所属账号”,避免固定落到第一个账号。
       const preferredAccountId = findPreferredRemotePlaybackAccountId(
       const preferredAccountId = findPreferredRemotePlaybackAccountId(
         fallbackSongs ?? [],
         fallbackSongs ?? [],
         activeAccount?.id?.toString() ?? ''
         activeAccount?.id?.toString() ?? ''
@@ -659,6 +661,7 @@ export struct FindView {
     )
     )
     if (supportsGlobalIndex && !isIndexReady) {
     if (supportsGlobalIndex && !isIndexReady) {
       ToastUtil.showToast('云端加载,请稍候')
       ToastUtil.showToast('云端加载,请稍候')
+      // 账号索引未就绪时,如果 DB 里已经有远程歌曲,就先用现有歌曲兜底播放。
       if (!shouldWaitForIndexedRemotePlayback(isIndexReady, fallbackSongs.length)) {
       if (!shouldWaitForIndexedRemotePlayback(isIndexReady, fallbackSongs.length)) {
         Logger.info(
         Logger.info(
           TAG,
           TAG,