Ver Fonte

瀑布流点击文件夹滚动到顶部

onecold há 11 meses atrás
pai
commit
fb86b69d2c
1 ficheiros alterados com 19 adições e 8 exclusões
  1. 19 8
      entry/src/main/ets/view/LocalMusic.ets

+ 19 - 8
entry/src/main/ets/view/LocalMusic.ets

@@ -3402,6 +3402,7 @@ export struct LocalMusic {
         }
 
         WaterFlow({
+          scroller:this.waterScroller,
           layoutMode: WaterFlowLayoutMode.SLIDING_WINDOW
         }) {
 
@@ -3601,12 +3602,16 @@ export struct LocalMusic {
       Stack() {
         Column() {
           Image(StrUtil.isEmpty(item.pixelMapPath) ? Utility.getMusisBg2(index) : item.pixelMapPath)
-            .attributeModifier(new ImageFancyModifier({
-              topLeft: 10,
-              topRight: 10,
+            .backgroundImageSize(ImageSize.Auto)
+            .borderRadius({
+              topLeft: 12,
+              topRight	: 12,
               bottomLeft: 0,
               bottomRight: 0
-            }, 60, 200))
+            })
+            .interpolation(ImageInterpolation.Medium)// 用于重采样后的抗锯齿
+            .draggable(false)// 禁止长按手势拖动
+            .autoResize(true) // 重采样,可减少内存占用
             .width('100%')
             .height('auto')
             .objectFit(ImageFit.Auto)
@@ -3837,6 +3842,7 @@ export struct LocalMusic {
   }
 
   private scroller: Scroller = new Scroller();
+  private waterScroller: Scroller = new Scroller();
   @State startIndex: number = 0
   @State endIndex: number = 0
   @State scaleValue: number = 1
@@ -4382,7 +4388,7 @@ export struct LocalMusic {
       Logger.info('this.twoFingerType2 = ' + this.twoFingerType);
       if (this.twoFingerType < 1) {
         this.twoFingerType = 4
-
+        this.columns = 1
       }
     }
     PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE, this.twoFingerType)
@@ -4810,8 +4816,12 @@ export struct LocalMusic {
             if (!this.isGridMusic) {
               this.listScroller.scrollToIndex(0)
             }
+            if(this.twoFingerType==4){
+              this.scroller.scrollTo({ xOffset: 0, yOffset: 0 })
+              this.waterScroller.scrollTo({ xOffset: 0, yOffset: 0 })
+            }
           }
-        }, 200)
+        }, 300)
         break;
       case CommonConstants.TYPE_IS_ARTIST:
         // 进入艺术家前安全保存当前滚动偏移量,支持列表和网格
@@ -6736,8 +6746,8 @@ export struct LocalMusic {
         Stack() {
 
           Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
-            .height(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
-            .width(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
+            .height(this.twoFingerType == 3||this.twoFingerType==4 ? 55 : this.twoFingerType == 2 ? 45 : 38)
+            .width(this.twoFingerType == 3||this.twoFingerType==4 ? 55 : this.twoFingerType == 2 ? 35 : 38)
             .alt($r('app.media.music_red'))
             .fillColor(this.themeColor)
             .borderRadius('100%')
@@ -6813,6 +6823,7 @@ export struct LocalMusic {
     }
     .backgroundColor(Color.Transparent)
     .width('100%')
+    .reuseId('son_item')
     .height(this.twoFingerType == 3 ? ITEM_HEIGHT_BIG : this.twoFingerType == 2 ? ITEM_HEIGHT : ITEM_HEIGHT_SMALL)
     .shadow(this.scaleItem === index ? {
       radius: 70,