Ver código fonte

优化播放页界面

onecold 9 meses atrás
pai
commit
455640fcbb
1 arquivos alterados com 95 adições e 65 exclusões
  1. 95 65
      entry/src/main/ets/view/LocalMusic.ets

+ 95 - 65
entry/src/main/ets/view/LocalMusic.ets

@@ -3731,9 +3731,10 @@ export struct LocalMusic {
           .fillColor(this.themeColor)// .fontSize(33)
           .alt($r('app.media.music_group'))
           .borderRadius('100%')
-          .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
-          .autoResize(true) // 重采样,可减少内存占用
+          // .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
+          // .autoResize(true) // 重采样,可减少内存占用
           .clip(true)
+          .sourceSize({width:38, height:38})
           .margin({ left: 20, top: 8, bottom: 8 })
         Column() {
           Text(item.name.startsWith('.') ? item.name.replace(/\./g, '') : item.name)
@@ -3826,9 +3827,9 @@ export struct LocalMusic {
             .borderRadius(this.isCoverRectangle?13:'100%')
             .clip(true)
             .draggable(false)
-            .sourceSize({width:50, height:50})
-            .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
-            .autoResize(true) // 重采样,可减少内存占用
+            .sourceSize({width:38, height:38})
+            // .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
+            // .autoResize(true) // 重采样,可减少内存占用
             .opacity(this.opacityItem)// 绑定透明度
             .margin({ left: 20 })
             .gesture(LongPressGesture()
@@ -5420,9 +5421,9 @@ export struct LocalMusic {
 
           }
           // .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 }),
-          //   TransitionEffect.scale({ x: 0, y: 0 })))
+          .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.9, y: 0.9 })
+            .animation({ duration: 500 }),
+            TransitionEffect.scale({ x: 0, y: 0 })))
           .clickEffect({ level: ClickEffectLevel.LIGHT })
           .swipeAction((
             (this.isSwipe&&this.modeType == 0 || this.modeType == 1 || ((this.modeType == 3 || this.modeType == 2) && this.isCanBack))
@@ -9216,7 +9217,7 @@ export struct LocalMusic {
           .width(24)
           .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
           .bindSheet($$this.isShowMoreView, this.PlayMoreSheet(), {
-            height:  '95%',
+            height:  '99%',
             preferType: this.currentBreakpoint!==BreakpointTypeEnum.SM?SheetType.CENTER:SheetType.BOTTOM,
             dragBar: true,
             showClose: true,
@@ -9277,33 +9278,11 @@ export struct LocalMusic {
         await this.playNext();
       })
 
-
-      if(this.isPhoneLan()){
-        this.fullButton()
-      }else{
-        Button({type:ButtonType.Circle,stateEffect:true}){
-          //添加或取消收藏
-          SymbolGlyph(Utility.getIsFav(this.favList,this.currentSong)?
-            $r('sys.symbol.heart_fill'):$r('sys.symbol.heart'))
-            .fontSize(23)
-            .fontColor([Color.White])
-            .alignSelf(ItemAlign.Center)
-            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
-            .aspectRatio(CommonConstants.ASPECT_RATIO)
-            .onClick(async () => {
-              if(this.currentSong){
-                this.doFav(this.currentSong)
-              }
-            })
-        }
-        .backgroundColor(Color.Transparent)
-        .height(45)
-        .width(45)
-      }
+      this.fullButton()
 
     }
     .width('95%')
-    .margin({ bottom:this.isCoverOpacity()?0:20 })
+    .margin({ bottom:this.isCoverOpacity()?0:15 })
     .justifyContent(FlexAlign.SpaceEvenly)
   }
 
@@ -9398,7 +9377,7 @@ export struct LocalMusic {
     //x5的竖屏模式需要99%
     .width(this.isLandscape?'80%':'93%')
     .justifyContent(FlexAlign.Center)
-    .margin({bottom:6})
+    .margin({bottom:3})
     .animation({
       duration: 666,
       curve: 'ease-in-out' // 可选动画曲线
@@ -9443,8 +9422,33 @@ export struct LocalMusic {
         this.setLoopMode()
       })
 
+      if(this.currentSong){
+        Button({type:ButtonType.Circle,stateEffect:true}){
+          Column() {
+            Image($r('app.media.rename2'))
+              .width(21)
+              .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+              .aspectRatio(CommonConstants.ASPECT_RATIO)
+          }
+        }
+        .bindSheet($$this.isShowEdit, this.editSheet(this.currentSong), {
+          height:  '99%',
+          dragBar: true,
+          showClose: true,
+          preferType:  SheetType.BOTTOM,
+          title: { title: '编辑标签' }
+        })
+        .height(45)
+        .width(45)
+        .layoutWeight(1)
+        .backgroundColor(Color.Transparent)
+        .onClick(async () => {
+          this.setEditStrEmpty()
+          this.tempLyricContent = this.lyricContent
+          this.isShowEdit = !this.isShowEdit;
+        })
+      }
 
-      this.fullButton()
 
 
       Button({type:ButtonType.Circle,stateEffect:true}){
@@ -9503,7 +9507,6 @@ export struct LocalMusic {
     .width(this.isLandscape?'88%':'95%')
     .justifyContent(FlexAlign.SpaceAround)
     .height(30)
-    .margin({top:3})
     .animation({
       duration: 666,
       curve: 'ease-in-out' // 可选动画曲线
@@ -9892,30 +9895,65 @@ export struct LocalMusic {
 
   @Builder
   private musicNameInfo(isHidden: boolean) {
-    Column({ space: 8 }) {
-      Text(this.isShowFileName&&this.currentSong?this.currentSong.fileName :this.name)
-        .fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 22)
-        .fontWeight(FontWeight.Bold)
-        .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
-        .maxLines(1)
-        .width('99%')
-        .textAlign(TextAlign.Center)
-        .fontColor(Color.White)
-      Text(this.artist + '  ' + this.currentSong?.album||'')
-        .fontSize(this.isCoverOpacity() ? 12 : 15)
-        .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
-        .fontColor(Color.White)
-        .textAlign(TextAlign.Center)
-        .visibility(StrUtil.isEmpty(this.artist)||this.isShowFileName?Visibility.None:Visibility.Visible)
-        .width('99%')
-        .maxLines(1)
+    Row(){
+
+      Column({ space: 8 }) {
+        Text(this.name)
+          .fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 20)
+          .fontWeight(FontWeight.Bold)
+          .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
+          .maxLines(1)
+          .width('99%')
+          .textAlign(TextAlign.Start)
+          .fontColor(Color.White)
+        Text(this.artist + '  ' + this.currentSong?.album)
+          .fontSize(this.isCoverOpacity() ? 12 : 15)
+          .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
+          .fontColor(Color.White)
+          .textAlign(TextAlign.Start)
+          .visibility(StrUtil.isEmpty(this.artist)?Visibility.None:Visibility.Visible)
+          .width('99%')
+          .maxLines(1)
+      }
+      .zIndex(1)
+      .layoutWeight(1)
+      .margin({ left: 15 })
+      .scale({ x: this.scaleValueImage, y: this.scaleValueImage }) // 添加缩放效果
+      Blank()
+      Row(){
+
+        Button({type:ButtonType.Circle,stateEffect:true}){
+          //添加或取消收藏
+          SymbolGlyph(Utility.getIsFav(this.favList,this.currentSong)?
+            $r('sys.symbol.heart_fill'):$r('sys.symbol.heart'))
+            .fontSize(22)
+            .fontColor([Color.White])
+            .alignSelf(ItemAlign.Center)
+            // .width(24)
+            .clickEffect({level:ClickEffectLevel.MIDDLE})
+            .aspectRatio(CommonConstants.ASPECT_RATIO)
+            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+            .onClick(async () => {
+              if(this.currentSong){
+                this.doFav(this.currentSong)
+              }
+            })
+        }
+        .margin({ left: 15,right:3 })
+        .backgroundColor(Color.Transparent)
+        .width(45)
+        .height(45)
+
+      }
+
+
     }
-    .margin({ top: this.isCoverOpacity() ? 20 : isHidden ? 40 : 20 })
-    .zIndex(1)
-    .scale({ x: this.scaleValueImage, y: this.scaleValueImage }) // 添加缩放效果
+    .width('90%')
+    .margin({ top: this.isCoverOpacity() ? 10 : isHidden ? 20 : 10 })
     .visibility(this.isCoverOpacity() || isHidden ? Visibility.None : Visibility.Visible)
   }
 
+
   @Builder
   private PlayTitle() {
 
@@ -11032,15 +11070,7 @@ export struct LocalMusic {
                 Text(more.title)
                   .fontSize(16)
                   .fontColor(Color.White)
-                  .bindSheet($$this.isShowEdit, this.editSheet(this.currentSong), {
-                    height:  '99%',
-                    dragBar: true,
-                    showClose: true,
-                    preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
-                    // blurStyle:BlurStyle.Thin,
-                    // backgroundColor:Color.Transparent,
-                    title: { title: '编辑标签' }
-                  })
+
               } else if (more.id === 5) { //定时关闭
                 Image(more.image)
                   .width(24)