Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

chendeben před 1 rokem
rodič
revize
cff06a3aa8

+ 2 - 58
entry/src/main/ets/common/util/Utility.ets

@@ -375,64 +375,6 @@ export class Utility {
   }
 
 
-  //获取资源的属性值
-  static async uriGetAssets(context:Context,uri:string,type:number): Promise<VideoItem> {
-    let isFromFileMan:boolean = false
-    if(uri.startsWith('file://media')){//图库的视频
-      isFromFileMan = false
-    }else{//从文件管理器
-      isFromFileMan = true
-    }
-
-    if(isFromFileMan){
-      return await Utility.uriGetAssetsFromFile(context,uri,type);
-    }
-    try {
-      let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
-      let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
-      // 配置查询条件,使用PhotoViewPicker选择图片返回的uri进行查询
-      predicates.equalTo('uri', uri);
-      let fetchOption: photoAccessHelper.FetchOptions = {
-        fetchColumns: [photoAccessHelper.PhotoKeys.WIDTH, photoAccessHelper.PhotoKeys.HEIGHT,
-          photoAccessHelper.PhotoKeys.TITLE, photoAccessHelper.PhotoKeys.SIZE, photoAccessHelper.PhotoKeys.DURATION],
-        predicates: predicates
-      };
-      let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> =
-        await phAccessHelper.getAssets(fetchOption);
-      // 得到uri对应的PhotoAsset对象,读取文件的部分信息
-      const asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
-
-      let fd = await Utility.getFdDir(uri)
-
-
-      let videoSize = asset.get(photoAccessHelper.PhotoKeys.SIZE).toString()
-      let videoTime = asset.get(photoAccessHelper.PhotoKeys.DATE_ADDED_MS).toString()
-      let fileSize = Utility.formatFSize(Number(videoSize))
-      let cTime = Utility.getFormatDateStr(videoTime,'yyyy-MM-dd HH:mm')
-      // let modifyDate = asset.get(photoAccessHelper.PhotoKeys.DATE_MODIFIED_MS).toString()
-      let item:VideoItem = new VideoItem( asset.displayName, fd,uri,type,Number(videoSize),cTime,
-        await Utility.getFetchFrameByTime(uri),fileSize)
-      console.info('asset displayName: ', asset.displayName);
-      console.info('asset uri: ', asset.uri);
-      console.info('asset photoType: ', asset.photoType);
-      console.info('asset width: ', asset.get(photoAccessHelper.PhotoKeys.WIDTH));
-      console.info('asset height: ', asset.get(photoAccessHelper.PhotoKeys.HEIGHT));
-      console.info('asset SIZE: ' + asset.get(photoAccessHelper.PhotoKeys.SIZE));
-      console.info('asset DURATION: ' + asset.get(photoAccessHelper.PhotoKeys.DURATION));
-      // 获取缩略图
-      // asset.getThumbnail((err, pixelMap) => {
-      //   if (err == undefined) {
-      //     console.info('getThumbnail successful ' + JSON.stringify(pixelMap));
-      //   } else {
-      //     console.error('getThumbnail fail', err);
-      //   }
-      // });
-      return item
-    } catch (error) {
-      console.error('uriGetAssets failed with err: ' + JSON.stringify(error));
-      return new VideoItem('','','',0,0,'')
-    }
-  }
 
   static getTimestampFromDateStr(dateStr: string, format: string = 'yyyy-MM-dd HH:mm'): number {
     // 定义正则表达式以匹配日期字符串中的各部分
@@ -718,6 +660,8 @@ export class Utility {
 
             if(StrUtil.isNotEmpty(metadata.album)){
               album = metadata.album
+            }else{
+              album = ''
             }
 
             if(StrUtil.isNotEmpty(metadata.duration)){

+ 15 - 11
entry/src/main/ets/pages/NewIndex.ets

@@ -261,24 +261,30 @@ struct NewIndex{
               .width('100%')
               .visibility(this.isCoverOpacity()?Visibility.None:Visibility.Visible)
               .height(180)
-            Blank()
-              .backgroundColor(this.themeColor)
-              .visibility(this.isCoverOpacity()?Visibility.Visible:Visibility.None)
-              .width('100%')
-              .height(55)
+              .borderRadius({
+                topLeft: 0,
+                topRight	: 20,
+                bottomLeft: 0,
+                bottomRight: 0
+              })
             // 动态生成抽屉菜单内容
             this.getDrawerView()
           }
-          .width(this.currentBreakpoint !== BreakpointTypeEnum.SM?'40%':'75%')
+          .width('100%')
           .height('100%')
-          .backgroundColor($r('app.color.silvery'))
           .onClick((event:ClickEvent)=>{
             // 阻止事件冒泡
           })
         }
-        .width('100%')
+        .width(this.currentBreakpoint !== BreakpointTypeEnum.SM?'36%':'70%')
         .height('100%')
-        .backgroundColor($r('app.color.ban_touming'))
+        .borderRadius({
+          topLeft: 0,
+          topRight	: 20,
+          bottomLeft: 0,
+          bottomRight: 20
+        })
+        .backgroundColor($r('app.color.silvery'))
         .alignItems(HorizontalAlign.Start)
         .onClick((event:ClickEvent)=>{
           // 点击抽屉外部关闭抽屉
@@ -489,9 +495,7 @@ struct NewIndex{
     }
     .width('100%')
     .alignListItem(ListItemAlign.Center)
-    .backgroundColor($r('app.color.silvery'))
     .layoutWeight(1)
-    // .divider({ strokeWidth: 1, color: this.isDarkMode? '333333':'#ffe9f0f0' })
     .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
   }
 

+ 3 - 2
entry/src/main/ets/pages/UserCenter.ets

@@ -442,14 +442,15 @@ export struct UserCenter {
       .padding({
         bottom: 45
       })
+      .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+        .animation({ duration: 380, curve: Curve.Ease,delay:50 }))
     }
     .backgroundColor($r('app.color.index_background'))
     .width('100%')
     .height('100%')
     .layoutWeight(1)
 
-    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
-      .animation({ duration: 380, curve: Curve.Ease,delay:50 }))
+
   }
 
   // 用户信息卡片

+ 27 - 18
entry/src/main/ets/view/LocalMusic.ets

@@ -654,6 +654,7 @@ export struct LocalMusic {
 
         case 104: //收到查询专辑列表
           this.albumMap = e.data.data1;
+
           this.albumList = e.data.data2
           break;
 
@@ -2068,9 +2069,11 @@ export struct LocalMusic {
   // 处理文件选择的函数
   handleFileSelection(item: VideoItem, checked: boolean) {
     if (checked) {
-      this.selectedFiles.push(item);
+      if (!this.selectedFiles.some(x => x.filePath == item.filePath)) {
+        this.selectedFiles.push(item);
+      }
     } else {
-      const index = this.selectedFiles.indexOf(item);
+      const index = this.selectedFiles.findIndex(x => x.filePath == item.filePath);
       if (index > -1) {
         this.selectedFiles.splice(index, 1);
       }
@@ -2339,7 +2342,7 @@ export struct LocalMusic {
             Text(`${this.artistMap.get(item.name)?.length ?? 0}首`)
               .fontSize(this.twoFingerType==1?11:this.twoFingerType==2?12:14)
               .padding({ top: 8 })
-              .visibility(this.modeType === 2 ? Visibility.Visible : Visibility.None)
+              .visibility(this.modeType === 2? Visibility.Visible : Visibility.None)
               .fontColor($r('app.color.text_color'))
               .margin({ left: 10 })
             Text(`${this.albumMap.get(item.name)?.length ?? 0}首`)
@@ -3084,7 +3087,7 @@ export struct LocalMusic {
     .cachedCount(3)
     // .columnsTemplate('1fr '.repeat(this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM ? 2 : 5))
     .columnsTemplate(this.twoFingerType==3?'repeat(auto-fit, 150)':this.twoFingerType==2?'repeat(auto-fit, 110)':'repeat(auto-fit, 80)')
-    .rowsGap(this.twoFingerType==3?25:this.twoFingerType==2?20:10)
+    .rowsGap(this.twoFingerType==3?10:this.twoFingerType==2?5:1)
     .visibility(this.isGridMusic?Visibility.Visible:Visibility.None)
     .scale({x:this.scaleValue,y:this.scaleValue,z:1})
     .gesture(PinchGesture({ fingers: 2 })
@@ -3160,8 +3163,8 @@ export struct LocalMusic {
             .alt($r('app.media.ic_avatar6'))
             .clip(true)
             .borderRadius({
-              topLeft: 20,
-              topRight	: 20,
+              topLeft: 12,
+              topRight	: 12,
               bottomLeft: 0,
               bottomRight: 0
             })
@@ -3252,7 +3255,7 @@ export struct LocalMusic {
 
         }
         .width(this.getGridWight())
-        .borderRadius(20)
+        .borderRadius(12)
         .backgroundImage(item.pixelMapPath)
         .backgroundImageSize({ height: '100%',width:'100%' })
         .backgroundBlurStyle(BlurStyle.BACKGROUND_ULTRA_THICK)
@@ -3260,7 +3263,7 @@ export struct LocalMusic {
 
 
         Checkbox({ name: 'checkbox' + index })
-          .select(this.selectedFiles.some(x  => x.filePath  === item.filePath))
+          .select(this.selectedFiles.some(x  => x.filePath  == item.filePath))
           .selectedColor(this.themeColor)
           .shape(CheckBoxShape.CIRCLE)
           .opacity(this.isMultiSelect ? 1 : 0)
@@ -3277,10 +3280,12 @@ export struct LocalMusic {
     }
     .backgroundColor(Color.Transparent)
     .width('100%')
+    .padding({top:15})
     .height(this.getGridAllHeight())
     .onClick(() => {
       if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
-        this.handleFileSelection(item, !this.selectedFiles.some(x  => x.filePath  === item.filePath))
+        const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
+        this.handleFileSelection(item, !isChecked);
       }else{
         this.doPlay(item, index)
       }
@@ -3289,16 +3294,16 @@ export struct LocalMusic {
   }
 
   getGridAllHeight(){
-    let heightG = 210
+    let heightG = 222
     switch (this.twoFingerType){
       case 1:
-        heightG = 105
+        heightG = 118
         break;
       case 2:
-        heightG = 155
+        heightG = 168
         break;
       case 3:
-        heightG = 210
+        heightG = 222
         break;
     }
     return heightG
@@ -3506,8 +3511,12 @@ export struct LocalMusic {
             && item.type !== CommonConstants.TYPE_IS_CSJAD &&
             !this.isHistory) ? { end: this.DeleteButton(item, index, item.filePath) } : {}) //左滑
         .onClick(() => {
-
-          this.doPlay(item, index)
+          if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
+            const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
+            this.handleFileSelection(item, !isChecked);
+          }else{
+            this.doPlay(item, index)
+          }
 
         })
 
@@ -6242,9 +6251,9 @@ export struct LocalMusic {
           .visibility(this.isPuraWP()?Visibility.None:Visibility.Visible)
           .borderRadius(this.isCoverRectangle ? 20 : '100%')
           .clickEffect({level:ClickEffectLevel.MIDDLE})
-          // .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
-          //   TransitionEffect.scale({ x: 0, y: 0 })  ))
-          .align(Alignment.Center)// .opacity(this.isCoverOpacity()||this.isCoverRectangle?0:1)
+          .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
+            TransitionEffect.scale({ x: 0, y: 0 })  ))
+          .align(Alignment.Center)//
           .clip(true)
           .rotate({
             x: 0,

+ 3 - 3
lib/src/main/ets/view/LyricView2.ets

@@ -206,10 +206,10 @@ export struct LyricView2 {
 
                 }
                 .padding(8)
-                // .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
-                //     TransitionEffect.scale({ x: 0, y: 0 })  ))
-                .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500,curve: Curve.Ease, delay: 100*index  }),
+                .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
                     TransitionEffect.scale({ x: 0, y: 0 })  ))
+                // .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500,curve: Curve.Ease, delay: 100*index  }),
+                //     TransitionEffect.scale({ x: 0, y: 0 })  ))
                 .border({ radius: 4 })
                 .backgroundColor(this.seekUIStyle == 'listItem' && index == this.seekIndex && item.text.length > 0
                     && this.enableSeek && this.isUserTouching ? '#80a9a9a9' : '#00000000')