Explorar el Código

优化长按的菜单

onecold hace 9 meses
padre
commit
12743a86ea

+ 31 - 28
entry/src/main/ets/view/LocalMusic.ets

@@ -2548,10 +2548,11 @@ export struct LocalMusic {
 
 
 
 
           Row() {
           Row() {
-            Button(this.isAllSelected ? '全不选' : '全选', { type: ButtonType.Circle, stateEffect: true })
-              .width(50)
-              .height(50)
-              .fontSize(13)
+
+            Button(this.isAllSelected ? '反选' : '全选', { type: ButtonType.Circle, stateEffect: true })
+              .width(45)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
@@ -2567,9 +2568,9 @@ export struct LocalMusic {
               })
               })
 
 
             Button('内嵌标签', { type: ButtonType.Capsule, stateEffect: true })
             Button('内嵌标签', { type: ButtonType.Capsule, stateEffect: true })
-              .width(90)
-              .height(50)
-              .fontSize(13)
+              .width(72)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
@@ -2586,9 +2587,9 @@ export struct LocalMusic {
               })
               })
 
 
             Button('合并', { type: ButtonType.Circle, stateEffect: true })
             Button('合并', { type: ButtonType.Circle, stateEffect: true })
-              .width(50)
-              .height(50)
-              .fontSize(11)
+              .width(45)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
@@ -2603,10 +2604,10 @@ export struct LocalMusic {
                 }
                 }
               })
               })
 
 
-            Button('歌单', { type: ButtonType.Circle, stateEffect: true })
-              .width(50)
-              .height(50)
-              .fontSize(13)
+            Button('+歌单', { type: ButtonType.Circle, stateEffect: true })
+              .width(45)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
@@ -2664,9 +2665,9 @@ export struct LocalMusic {
             //   })
             //   })
 
 
             Button('删除', { type: ButtonType.Circle, stateEffect: true })
             Button('删除', { type: ButtonType.Circle, stateEffect: true })
-              .width(50)
-              .height(50)
-              .fontSize(13)
+              .width(45)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .visibility(this.isFavMusic ? Visibility.None : Visibility.Visible)
               .visibility(this.isFavMusic ? Visibility.None : Visibility.Visible)
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
@@ -2675,9 +2676,9 @@ export struct LocalMusic {
                 this.showWarnIsDelete()
                 this.showWarnIsDelete()
               })
               })
             Button('取消', { type: ButtonType.Circle, stateEffect: true })
             Button('取消', { type: ButtonType.Circle, stateEffect: true })
-              .width(50)
-              .height(50)
-              .fontSize(13)
+              .width(45)
+              .height(45)
+              .fontSize(10)
               .margin({ top: 10, bottom: 10, right: 6 })
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
               .backgroundColor(this.themeColor)
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
               .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
@@ -2696,8 +2697,7 @@ export struct LocalMusic {
             duration: 666,
             duration: 666,
             curve: 'ease-in-out' // 可选动画曲线
             curve: 'ease-in-out' // 可选动画曲线
           })
           })
-          .position(this.isShowCoverHeader() ? { bottom: 78 }
-            : { bottom: this.isPhoneLan() ? 130 : 170 }) // 将 Row 固定在底部
+          .position({ bottom: 20 }) // 将 Row 固定在底部
 
 
 
 
         }
         }
@@ -3731,6 +3731,8 @@ export struct LocalMusic {
           .fillColor(this.themeColor)// .fontSize(33)
           .fillColor(this.themeColor)// .fontSize(33)
           .alt($r('app.media.music_group'))
           .alt($r('app.media.music_group'))
           .borderRadius('100%')
           .borderRadius('100%')
+          .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
+          .autoResize(true) // 重采样,可减少内存占用
           .clip(true)
           .clip(true)
           .margin({ left: 20, top: 8, bottom: 8 })
           .margin({ left: 20, top: 8, bottom: 8 })
         Column() {
         Column() {
@@ -3823,6 +3825,7 @@ export struct LocalMusic {
             .borderRadius(this.isCoverRectangle?13:'100%')
             .borderRadius(this.isCoverRectangle?13:'100%')
             .clip(true)
             .clip(true)
             .draggable(false)
             .draggable(false)
+            .sourceSize({width:50, height:50})
             .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
             .interpolation(ImageInterpolation.High)// 用于重采样后的抗锯齿
             .autoResize(true) // 重采样,可减少内存占用
             .autoResize(true) // 重采样,可减少内存占用
             .opacity(this.opacityItem)// 绑定透明度
             .opacity(this.opacityItem)// 绑定透明度
@@ -5415,9 +5418,9 @@ export struct LocalMusic {
 
 
           }
           }
           // .transition(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }))
           // .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: 1.2, y: 1.2 })
+          //   .animation({ duration: 500 }),
+          //   TransitionEffect.scale({ x: 0, y: 0 })))
           .clickEffect({ level: ClickEffectLevel.LIGHT })
           .clickEffect({ level: ClickEffectLevel.LIGHT })
           .swipeAction((
           .swipeAction((
             (this.isSwipe&&this.modeType == 0 || this.modeType == 1 || ((this.modeType == 3 || this.modeType == 2) && this.isCanBack))
             (this.isSwipe&&this.modeType == 0 || this.modeType == 1 || ((this.modeType == 3 || this.modeType == 2) && this.isCanBack))
@@ -5566,11 +5569,11 @@ export struct LocalMusic {
     .contentStartOffset(this.topSafeHeight + 55)
     .contentStartOffset(this.topSafeHeight + 55)
     .scrollBar(BarState.Off)
     .scrollBar(BarState.Off)
     .contentEndOffset(this.bottomBarHeight+this.bottomSafeHeight)
     .contentEndOffset(this.bottomBarHeight+this.bottomSafeHeight)
-    .cachedCount(6)
+    .cachedCount(5)
     .reuseId('list_item')
     .reuseId('list_item')
     .borderRadius(20)
     .borderRadius(20)
-    .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.8, y: 0.8 }).animation({ duration: 500 }),
-      TransitionEffect.scale({ x: 0, y: 0 })))
+    // .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.9, y: 0.9 }).animation({ duration: 400 }),
+    //   TransitionEffect.scale({ x: 0, y: 0 })))
     .layoutWeight(1)
     .layoutWeight(1)
     .onScrollIndex((start) => {
     .onScrollIndex((start) => {
       this.selectedIndex = start
       this.selectedIndex = start

+ 1 - 1
entry/src/main/ets/view/RotatingCover.ets

@@ -51,7 +51,7 @@ export struct RotatingCover {
 
 
   build() {
   build() {
     Column() {
     Column() {
-      Image(this.songLabel === undefined ||StrUtil.isEmpty(this.songLabel)? $r('app.media.music_red') : this.songLabel)
+      Image(this.songLabel)
         .height(42)
         .height(42)
         .width(42)
         .width(42)
         .alt( $r('app.media.music_red'))
         .alt( $r('app.media.music_red'))