소스 검색

右下角的播放列表,双指缩放单独值调整,不和主列表的值联动

onecold 11 달 전
부모
커밋
eba74eb293
1개의 변경된 파일35개의 추가작업 그리고 11개의 파일을 삭제
  1. 35 11
      entry/src/main/ets/view/LocalMusic.ets

+ 35 - 11
entry/src/main/ets/view/LocalMusic.ets

@@ -473,6 +473,7 @@ export struct LocalMusic {
 
 
   // 组件生命周期
   // 组件生命周期
   aboutToAppear() {
   aboutToAppear() {
+    this.sonTwoFingerType = PreferencesUtil.getNumberSync('sonTwoFingerType', 3);
     let lastCount = AppStorage.get<number>('columnsCount');
     let lastCount = AppStorage.get<number>('columnsCount');
     if (typeof lastCount != 'undefined') {
     if (typeof lastCount != 'undefined') {
       this.columns = lastCount;
       this.columns = lastCount;
@@ -6725,7 +6726,7 @@ export struct LocalMusic {
     .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 })
     .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 })
     .gesture(PinchGesture({ fingers: 2 })
     .gesture(PinchGesture({ fingers: 2 })
       .onActionEnd((event: GestureEvent) => {
       .onActionEnd((event: GestureEvent) => {
-        this.setlistTwoFingers()
+        this.setSonListTwoFingers()
       })
       })
       .onActionUpdate(e => {
       .onActionUpdate(e => {
         this.scaleValue = this.pinchValue * e.scale
         this.scaleValue = this.pinchValue * e.scale
@@ -6739,6 +6740,29 @@ export struct LocalMusic {
 
 
   }
   }
 
 
+  setSonListTwoFingers() {
+    this.pinchValue = this.scaleValue;
+    Logger.info('this.pinchValue = ' + this.pinchValue);
+    if (this.pinchValue >= 1) {
+      this.sonTwoFingerType++
+      Logger.info('this.twoFingerType1 = ' + this.sonTwoFingerType);
+      if (this.sonTwoFingerType > 3) {
+        this.sonTwoFingerType = 1
+        PreferencesUtil.put(SettingPage.IS_GRID_MUSIC, this.isGridMusic)
+      }
+    } else {
+      this.sonTwoFingerType--
+      Logger.info('this.twoFingerType2 = ' + this.sonTwoFingerType);
+      if (this.sonTwoFingerType < 1) {
+        this.sonTwoFingerType = 1
+      }
+    }
+    PreferencesUtil.put('sonTwoFingerType', this.sonTwoFingerType)
+    this.pinchValue = 1;
+    this.scaleValue = 1;
+  }
+
+  @State sonTwoFingerType:number = 3
   @Builder
   @Builder
   private MusicItemSon(item: VideoItem, index?: number) {
   private MusicItemSon(item: VideoItem, index?: number) {
     Button({ type: ButtonType.Normal, stateEffect: true }) {
     Button({ type: ButtonType.Normal, stateEffect: true }) {
@@ -6746,8 +6770,8 @@ export struct LocalMusic {
         Stack() {
         Stack() {
 
 
           Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
           Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
-            .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)
+            .height(this.sonTwoFingerType == 3||this.sonTwoFingerType==4 ? 55 : this.sonTwoFingerType == 2 ? 48 : 40)
+            .width(this.sonTwoFingerType == 3||this.sonTwoFingerType==4 ? 55 : this.sonTwoFingerType == 2 ? 48 : 40)
             .alt($r('app.media.music_red'))
             .alt($r('app.media.music_red'))
             .fillColor(this.themeColor)
             .fillColor(this.themeColor)
             .borderRadius('100%')
             .borderRadius('100%')
@@ -6760,34 +6784,34 @@ export struct LocalMusic {
           Column() {
           Column() {
 
 
             Text(item.name)
             Text(item.name)
-              .fontSize(this.twoFingerType == 1 ? 12 : this.twoFingerType == 2 ? 15 : 18)
+              .fontSize(this.sonTwoFingerType == 1 ? 12 : this.sonTwoFingerType == 2 ? 15 : 18)
               .fontColor(this.curIndex === index ? this.themeColor :
               .fontColor(this.curIndex === index ? this.themeColor :
                 this.isFrontWhite ? Color.White : $r('app.color.text_color'))
                 this.isFrontWhite ? Color.White : $r('app.color.text_color'))
               .maxLines(1)
               .maxLines(1)
-              .margin({ left: this.twoFingerType == 3 ? 18 : 10 })
+              .margin({ left: this.sonTwoFingerType == 3 ? 18 : 10 })
             Row() {
             Row() {
               Column(){
               Column(){
                 Text(item.md5Str?.includes('Lossless')?
                 Text(item.md5Str?.includes('Lossless')?
                 Utility.resourceToString(this.context,$r('app.string.lossless')):item.md5Str)//音质
                 Utility.resourceToString(this.context,$r('app.string.lossless')):item.md5Str)//音质
-                  .fontSize(this.twoFingerType == 1 ? 8 : this.twoFingerType == 2 ? 9 : 11)
+                  .fontSize(this.sonTwoFingerType == 1 ? 8 : this.sonTwoFingerType == 2 ? 9 : 11)
                   .padding({ top: 3,right:6,left:6,bottom:3 })
                   .padding({ top: 3,right:6,left:6,bottom:3 })
                   .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
                   .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
                   $r('app.color.text_color'))
                   $r('app.color.text_color'))
                   .fontWeight(500)
                   .fontWeight(500)
                   .borderRadius(12)
                   .borderRadius(12)
-                  .margin({ left: this.twoFingerType == 3 ? 12 : 10 })
+                  .margin({ left: this.sonTwoFingerType == 3 ? 12 : 10 })
                   .backgroundColor('#FFC107')
                   .backgroundColor('#FFC107')
               }
               }
               .padding({ top: 8 })
               .padding({ top: 8 })
               Text(StrUtil.isEmpty(item.artist) ? item.cTime : item.artist + '  ' + item?.album)
               Text(StrUtil.isEmpty(item.artist) ? item.cTime : item.artist + '  ' + item?.album)
-                .fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
+                .fontSize(this.sonTwoFingerType == 1 ? 11 : this.sonTwoFingerType == 2 ? 12 : 14)
                 .padding({ top: 8 })
                 .padding({ top: 8 })
                 .fontColor(this.curIndex === index ? this.themeColor :
                 .fontColor(this.curIndex === index ? this.themeColor :
                   this.isFrontWhite ? $r('app.color.playlistText_color') : $r('app.color.text_color'))
                   this.isFrontWhite ? $r('app.color.playlistText_color') : $r('app.color.text_color'))
-                .margin({ left: this.twoFingerType == 3 ? 5 : 3 })
+                .margin({ left: this.sonTwoFingerType == 3 ? 5 : 3 })
               Blank()
               Blank()
               Text(item.size)
               Text(item.size)
-                .fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
+                .fontSize(this.sonTwoFingerType == 1 ? 11 : this.sonTwoFingerType == 2 ? 12 : 14)
                 .padding({ top: 8 })
                 .padding({ top: 8 })
                 .visibility(StrUtil.isEmpty(item.artist) ? Visibility.Visible : Visibility.None)
                 .visibility(StrUtil.isEmpty(item.artist) ? Visibility.Visible : Visibility.None)
                 .fontColor(this.curIndex === index ? $r('app.color.title_bar_bg_text') :
                 .fontColor(this.curIndex === index ? $r('app.color.title_bar_bg_text') :
@@ -6824,7 +6848,7 @@ export struct LocalMusic {
     .backgroundColor(Color.Transparent)
     .backgroundColor(Color.Transparent)
     .width('100%')
     .width('100%')
     .reuseId('son_item')
     .reuseId('son_item')
-    .height(this.twoFingerType == 3 ? ITEM_HEIGHT_BIG : this.twoFingerType == 2 ? ITEM_HEIGHT : ITEM_HEIGHT_SMALL)
+    .height(this.sonTwoFingerType == 3 ? ITEM_HEIGHT_BIG : this.sonTwoFingerType == 2 ? ITEM_HEIGHT+10 : ITEM_HEIGHT_SMALL+10)
     .shadow(this.scaleItem === index ? {
     .shadow(this.scaleItem === index ? {
       radius: 70,
       radius: 70,
       color: '#15000000',
       color: '#15000000',