소스 검색

修复第三方应用打开音乐文件需要openMusic

onecold 5 달 전
부모
커밋
6f44efc716
2개의 변경된 파일22개의 추가작업 그리고 4개의 파일을 삭제
  1. 12 1
      entry/src/main/ets/common/util/LazyDataSource.ets
  2. 10 3
      entry/src/main/ets/view/LocalMusic.ets

+ 12 - 1
entry/src/main/ets/common/util/LazyDataSource.ets

@@ -126,4 +126,15 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
     this.notifyDataReload();
   }
 
-}
+  public appendArrayData(newData: T[]): void {
+    if (!newData || newData.length === 0) {
+      return;
+    }
+    const start = this.dataArray.length;
+    this.dataArray.push(...newData);
+    for (let index = 0; index < newData.length; index++) {
+      this.notifyDataAdd(start + index);
+    }
+  }
+
+}

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

@@ -2045,6 +2045,10 @@ export struct LocalMusic {
       workerInstance.postMessage({ code: 2, data: this.context,data2:this.packName });
     }
     if (this.modeType !== 0) {
+      // 第三方打开场景:非文件夹模式也需要继续执行自动播放
+      if (isOpen && destPath) {
+        this.openMusic(true, destPath, openItem)
+      }
       return
     }
     console.info('onecold getSortedFiles 2')
@@ -5208,7 +5212,7 @@ export struct LocalMusic {
             Text(this.isShowFileName?item.fileName :item.name)
               .fontSize(this.twoFingerType == 1 ? 12 : this.twoFingerType == 2 ? 15 : 18)
               .maxLines(1)
-              .textOverflow({ overflow: TextOverflow.Ellipsis })//列表模式固定省略
+              .textOverflow({ overflow: this.isLongNameRoLL&&!this.isScrolling?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
               .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
                 $r('app.color.text_color'))
               .margin({ left: this.twoFingerType == 3 ? 6 : 8 })
@@ -5686,7 +5690,7 @@ export struct LocalMusic {
               .fontSize(this.columns == 4 ||this.columns==3? 12 : this.columns == 2 ? 15 : 18)
               .maxLines(1)
               .fontWeight(FontWeight.Bold)
-              .textOverflow({ overflow: TextOverflow.Ellipsis })//瀑布流固定省略
+              .textOverflow({ overflow: this.isLongNameRoLL&&!this.isScrolling?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
               .bindSheet(this.longItemFilePathDetail== item.filePath, this.detailSheet(item), {
                 height:  '95%',
                 dragBar: true,
@@ -6062,7 +6066,7 @@ export struct LocalMusic {
               .fontSize(this.twoFingerType == 1 ? 12 : this.twoFingerType == 2 ? 15 : 18)
               .maxLines(1)
               .fontWeight(FontWeight.Bold)
-              .textOverflow({ overflow: TextOverflow.Ellipsis })//Grid固定省略
+              .textOverflow({ overflow: this.isLongNameRoLL&&!this.isScrolling?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
               .bindSheet(this.longItemFilePathDetail== item.filePath, this.detailSheet(item), {
                 height:  '100%',
                 dragBar: true,
@@ -16445,6 +16449,9 @@ export struct LocalMusic {
 
   //下一个
   private async playNext() {
+    this.lyricController.setLyric(null)
+    this.lyricControllerXF.setLyric(null)
+    this.lyricControllerSingle.setLyric(null)
     Logger.info('heanup playNext', '========== playNext 开始 ==========');
     Logger.info('heanup playNext', `isCastPlaying=${this.isCastPlaying}, castControllerWrapper存在=${!!this.castControllerWrapper}`);