Sfoglia il codice sorgente

修改动画效果

onecold 1 anno fa
parent
commit
8ff77feb25

+ 12 - 0
entry/src/main/ets/common/util/Utility.ets

@@ -865,6 +865,18 @@ export class Utility {
     }
     return list
   }
+  //获取列表有封面的值
+  static getFirstCoverFromList(localList:Array<VideoItem>):string{
+    let list: Array<string> = [];
+    for(let i=0;i<localList.length;i++){
+      let pix = localList[i].pixelMapPath
+      if(pix){
+       return pix
+      }
+
+    }
+    return ''
+  }
 
   //根据type获取对应的播放列表(CommonConstants.TYPE_LOCAL:本地,CommonConstants.TYPE_Dir:私密视频)
   static getGlobalNameList(localList:Array<VideoItem>,type:number){

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

@@ -284,7 +284,6 @@ struct NewIndex {
       return true
     }
 
-
     return false
   }
 

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

@@ -852,9 +852,7 @@ export struct LocalMusic {
       // this.videoLocalList = cachedValue;
       Logger.info('onecold 有缓存 cachedValue = ' + cachedValue)
       if(this.currentPath !=this.rootPath){//第一个封面赋值给currentTitleCover
-        if(cachedValue[0].pixelMapPath){
-          this.currentTitleCover = cachedValue[0].pixelMapPath
-        }
+        this.currentTitleCover = Utility.getFirstCoverFromList(cachedValue)
       }
       this.updateListData(cachedValue)
     }
@@ -927,9 +925,8 @@ export struct LocalMusic {
 
       if (ArrayUtil.isNotEmpty(files)) {
         if(this.currentPath !=this.rootPath){
-          if(files[0].pixelMapPath){
-            this.currentTitleCover = files[0].pixelMapPath//第一个封面赋值给currentTitleCover
-          }
+          if(cachedValue)
+            this.currentTitleCover = Utility.getFirstCoverFromList(cachedValue)
         }
         // 缓存结果
         this.addCache(curPath, this.videoLocalList);
@@ -2799,8 +2796,10 @@ export struct LocalMusic {
       .padding({top:this.topRectHeight ,bottom:this.bottomBarHeight+48  })
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
       .justifyContent(FlexAlign.SpaceBetween)
+      // .transition({ type: TransitionType.Insert, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
+      // .transition({ type: TransitionType.Delete, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
       // .transition(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }))
-      .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
+      .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.7, y: 0.7}).animation({ duration: 500 }),
         TransitionEffect.scale({ x: 0, y: 0 })  ))
       .clickEffect({level:ClickEffectLevel.LIGHT})
       // .animation({
@@ -4046,6 +4045,8 @@ export struct LocalMusic {
 
           if (ArrayUtil.isEmpty(this.historyList)) {
             ToastUtil.showToast('最近播放记录空空如也')
+          }else{
+            this.currentTitleCover = Utility.getFirstCoverFromList(this.historyList)
           }
           this.isHistory = true
           this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))
@@ -4057,6 +4058,8 @@ export struct LocalMusic {
           this.updateListData(this.favList)
           if(ArrayUtil.isEmpty(this.favList)){
             ToastUtil.showToast('无音乐收藏记录')
+          }else{
+            this.currentTitleCover = Utility.getFirstCoverFromList(this.favList)
           }
           this.isFavMusic = true
           this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))